aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/port/snprintf.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/port/snprintf.c b/src/port/snprintf.c
index b7eb2d7f27e..61b452844c3 100644
--- a/src/port/snprintf.c
+++ b/src/port/snprintf.c
@@ -110,6 +110,16 @@
#undef printf
/*
+ * We use the platform's native snprintf() for some machine-dependent cases.
+ * While that's required by C99, Microsoft Visual Studio lacks it before
+ * VS2015. Fortunately, we don't really need the length check in practice,
+ * so just fall back to native sprintf() on that platform.
+ */
+#if defined(_MSC_VER) && _MSC_VER < 1900 /* pre-VS2015 */
+#define snprintf(str,size,...) sprintf(str,__VA_ARGS__)
+#endif
+
+/*
* Info about where the formatted output is going.
*
* dopr and subroutines will not write at/past bufend, but snprintf