Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorAlex Zolotarev <alex@maps.me>2015-12-15 16:15:37 +0300
committerAlex Zolotarev <alex@maps.me>2015-12-15 16:17:29 +0300
commit00dd0708ad64967c6cf2df4683afe228b47943f1 (patch)
tree7ce5947cac46a7110c4460c1eb426dd2a26ced79 /std
parent9ca0eb3157744ed794bbaeff4e936a46c01b07e4 (diff)
snprintf compilation support for MSVC.
Diffstat (limited to 'std')
-rw-r--r--std/cstdio.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/std/cstdio.hpp b/std/cstdio.hpp
index b85bbd73b9..1fa6b27e6b 100644
--- a/std/cstdio.hpp
+++ b/std/cstdio.hpp
@@ -4,6 +4,22 @@
#undef new
#endif
+// Correct snprintf support for MSVC. It was finaly implemented in MS Visual Studio 2015.
+// Original code: https://github.com/OlehKulykov/jansson/commit/8f2298bad8f77a22efe0dc9a95676fae6c203e36
+#if defined(_WIN32) || defined(WIN32)
+# if defined(_MSC_VER) /* MS compiller */
+# if (_MSC_VER < 1900) && !defined(snprintf) /* snprintf not defined yet & not introduced */
+# define snprintf _snprintf
+# endif
+# if (_MSC_VER < 1500) && !defined(vsnprintf) /* vsnprintf not defined yet & not introduced */
+# define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
+# endif
+# else /* Other Windows compiller, old definition */
+# define snprintf _snprintf
+# define vsnprintf _vsnprintf
+# endif
+#endif
+
#include <cstdio>
#ifdef DEBUG_NEW