On 2020-05-27 17:16, Martin Storsjö wrote:
On Wed, 27 May 2020, Steve Lhomme wrote:
__ms_vsnprintf is not available in ucrtbase/ucrt.
__stdio_common_vsprintf is available and can be used for the same call.
---
mingw-w64-headers/crt/stdio.h | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/mingw-w64-headers/crt/stdio.h
b/mingw-w64-headers/crt/stdio.h
index d7beb27a..9c233efa 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -882,10 +882,6 @@ char * tmpnam(char * __dst)
#pragma push_macro("vsnprintf")
# undef snprintf
# undef vsnprintf
- __attribute__((__format__ (ms_printf, 3, 0)))
__MINGW_ATTRIB_NONNULL(3)
- int __cdecl __ms_vsnprintf(char * __restrict__ d,size_t n,const
char * __restrict__ format,va_list arg)
- __MINGW_ATTRIB_DEPRECATED_MSVC2005
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-
__mingw_bos_ovr
__attribute__((__format__ (ms_printf, 3, 0))) __MINGW_ATTRIB_NONNULL(3)
int vsnprintf (char * __restrict__ __stream, size_t __n, const char
* __restrict__ __format, va_list __local_argv)
@@ -893,7 +889,10 @@ char * tmpnam(char * __dst)
#if __MINGW_FORTIFY_LEVEL > 0
__mingw_bos_ptr_chk_warn(__stream, __n, 1);
#endif
- return __ms_vsnprintf (__stream, __n, __format, __local_argv);
+ int __retval = __stdio_common_vsprintf(
+ _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS |
_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
+ __stream, __n, __format, NULL, __local_argv);
+ return __retval < 0 ? -1 : __retval;
}
Uhm, what?
It isn't visible from the patch context, but as far as I can see when
reading the header, this is in a !_UCRT context?
On line 858, there's "#ifdef _UCRT", matched with an #else on line 871,
and then you have this code on lines 885-897 - in the non-UCRT case?
I totally agree with that. That's incorrect when _UCRT is used.
So in _UCRT I call __stdio_common_vsprintf() and not __ms_vsnprintf().
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public