Per MS documentation, macros _stprintf and _vstprintf always expands to
s(w)printf function variant which does not take buffer size argument.

https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/sprintf-sprintf-l-swprintf-swprintf-l-swprintf-l

So _stprintf() expands either to C89 sprintf() function or to MS-specific
_swprintf() function. C95 swprintf() takes buffer size argument and so, it
is not compatible for _stprintf() and cannot be used.

So replace swprintf by _swprintf in _UNICODE mode of _stprintf expansion.
---
 mingw-w64-headers/crt/tchar.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h
index e0ce3f4741e2..3069d7139da4 100644
--- a/mingw-w64-headers/crt/tchar.h
+++ b/mingw-w64-headers/crt/tchar.h
@@ -149,7 +149,7 @@ extern "C" {
 #define _ftprintf_l _fwprintf_l
 #define _ftprintf_p _fwprintf_p
 #define _ftprintf_p_l _fwprintf_p_l
-#define _stprintf swprintf
+#define _stprintf _swprintf
 #define _stprintf_l __swprintf_l
 #define _stprintf_p _swprintf_p
 #define _stprintf_p_l _swprintf_p_l
@@ -167,7 +167,7 @@ extern "C" {
 #define _vftprintf_l _vfwprintf_l
 #define _vftprintf_p _vfwprintf_p
 #define _vftprintf_p_l _vfwprintf_p_l
-#define _vstprintf vswprintf
+#define _vstprintf _vswprintf
 #define _vstprintf_l _vswprintf_l
 #define _vstprintf_p _vswprintf_p
 #define _vstprintf_p_l _vswprintf_p_l
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to