Format %c and %s when used in some wide wprintf function takes the wide
wchar_t character or wide wchar_t* string. This is msvcrt.dll and UCRT behavior.
This change aligns the mingw-w64 wprintf functions to be compatible with MS.
---
mingw-w64-crt/stdio/mingw_pformat.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/mingw-w64-crt/stdio/mingw_pformat.c
b/mingw-w64-crt/stdio/mingw_pformat.c
index c8bff4b539be..0af793ba9824 100644
--- a/mingw-w64-crt/stdio/mingw_pformat.c
+++ b/mingw-w64-crt/stdio/mingw_pformat.c
@@ -2501,7 +2501,11 @@ __pformat (int flags, void *dest, int max, const APICHAR
*fmt, va_list argv)
/* Now we invoke the appropriate format handler...
*/
if( (length == PFORMAT_LENGTH_LONG)
- || (length == PFORMAT_LENGTH_LLONG) )
+ || (length == PFORMAT_LENGTH_LLONG)
+ #ifdef __BUILD_WIDEAPI
+ || (length == PFORMAT_LENGTH_INT)
+ #endif
+ )
{
/* considering any `long' type modifier as a reference to
* `wchar_t' data, (which is promoted to an `int' argument)...
@@ -2537,7 +2541,11 @@ __pformat (int flags, void *dest, int max, const APICHAR
*fmt, va_list argv)
case 's':
if( (length == PFORMAT_LENGTH_LONG)
- || (length == PFORMAT_LENGTH_LLONG))
+ || (length == PFORMAT_LENGTH_LLONG)
+ #ifdef __BUILD_WIDEAPI
+ || (length == PFORMAT_LENGTH_INT)
+ #endif
+ )
{
/* considering any `long' type modifier as a reference to
* a `wchar_t' string...
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public