diff --git a/src/port/snprintf.c b/src/port/snprintf.c index b7eb2d7f27..61b452844c 100644 --- a/src/port/snprintf.c +++ b/src/port/snprintf.c @@ -109,6 +109,16 @@ #undef vprintf #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. *