mirror of
https://git.code.sf.net/p/mingw-w64/mingw-w64
synced 2024-11-23 01:44:43 +08:00
73cf399a16
msvcr80+ has following wide-buffer swprintf like function symbols, none of them is compatible with C95 (v)swprintf function, differences are: _(v)swprintf - does not take buffer size argument, like non-wide C89 sprintf _(v)snwprintf - does not fill nul-term wide char if there is not space for it, like non-wide msvcr _(v)snprintf _(v)swprintf_c - clears the first wide character in buffer on error (error means that there is no space for nul-term or conversion error occurred) Version before msvcr80 has following function symbols: _(v)snwprintf - same as in msvcrt80+ (v)swprintf - same as _(v)swprintf in msvcrt80+ There is no (v)swprintf symbol in msvcr80+ (neither in UCRT) and there are no _(v)swprintf_c/_(v)swprintf symbols before msvcr80. Additionally msvcr80+ header files defines (v)swprintf() function as inline wrapper function around _vswprintf_c_l() with NULL locale, which is same as _vswprintf_c(). Therefore that msvcr80+ inline function (v)swprintf() is not C95 compatible. UCRT header files provides all those msvcr80+ swprintf family functions defined as inline. But UCRT changed behavior of _(v)swprintf_c function, on error it does not clear the first wide character in buffer, but instead puts the nul wide character at current position. So with this change the (v)swprintf() function definition in UCRT header file is C95 compatible. mingw-w64 header files declares and defines (v)swprintf() without the buffer size argument, matching the pre-msvcr80 (v)swprintf symbol. So mingw-w64 has currently broken C95+ support for swprintf(), vswprintf(), __ms_swprintf() and __ms_vswprintf() symbols, and for swprintf() and vswprintf() functions provided by mingw-w64 header files when macro __USE_MINGW_ANSI_STDIO is set to 0 (which is default for UCRT). Fix this issue. Ensure that swprintf and vswprintf symbols are always C95 compatible in every CRT import library. Function symbols which do not take buffer size are always under name with underscore prefix. For non-UCRT import libraries provide mingw-w64 swprintf and vswprintf implementations which calls _vsnwprintf and fill nul-term wide char. Original pre-msvcr80 DLL symbols swprintf and vswprintf are renamed to _swprintf and _vswprintf, for compatibility with msvcr80+ and UCRT. Fix declarations of __ms_swprintf and __ms_vswprintf functions in header files to include buffer size argument, to make them C95 compatible too. crt-aliases.def.in file is updated to reflect this change (which completely drops incompatible __ms_swprintf and __ms_vswprintf aliases and then also unused PRE_C95_SWPRINTF macro). With all these changes, functions swprintf() and vswprintf() when __USE_MINGW_ANSI_STDIO is set to 0 are now compatible with ISO C95+. Signed-off-by: Martin Storsjö <martin@martin.st> |
||
---|---|---|
build-aux | ||
COPYING.MinGW-w64 | ||
COPYING.MinGW-w64-runtime | ||
mingw-w64-crt | ||
mingw-w64-doc | ||
mingw-w64-headers | ||
mingw-w64-libraries | ||
mingw-w64-tools | ||
.gitignore | ||
aclocal.m4 | ||
AUTHORS | ||
config.h.in | ||
configure | ||
configure.ac | ||
COPYING | ||
DISCLAIMER | ||
DISCLAIMER.PD | ||
Makefile.am | ||
Makefile.in |