From 134dc0bcaf60ac54ae0b6d9f154fb158bf734549 Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Sun, 21 Apr 2019 12:54:39 +0100 Subject: [PATCH] Avoid using _vsnprintf on MinGW. We went to the trouble of getting standard C99 format strings with __USE_MINGW_ANSI_STDIO, but then used _vsnprintf, which bypasses them and implements the non-standard Microsoft format strings, leading to incorrect behaviour. Ubuntu 14.04's mingw-w64 at least defines a vsnprintf() in all circumstances, so we should use it. --- utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils.c b/utils.c index 17f67587..9824110e 100644 --- a/utils.c +++ b/utils.c @@ -308,7 +308,10 @@ int string_length_for_printf(size_t s) #endif /* Also lack of vsnprintf before VS2015 */ -#if defined _WINDOWS && !defined __WINE__ && _MSC_VER < 1900 +#if defined _WINDOWS && \ + !defined __MINGW32__ && \ + !defined __WINE__ && \ + _MSC_VER < 1900 #define vsnprintf _vsnprintf #endif