Modifier w for %s, %S, %c and %C is same as modifier l.
It is common that wchar_t* string is printed by %ws format by Windows
applications.

This change allows to use %ws by applications compiled by flag
-D__USE_MINGW_ANSI_STDIO=1, which is by default enabled for C99+ msvcrt.dll
builds.

Modifier w is supported by crtdll, msvcrt and UCRT libraries.
---
 mingw-w64-crt/stdio/mingw_pformat.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/mingw-w64-crt/stdio/mingw_pformat.c 
b/mingw-w64-crt/stdio/mingw_pformat.c
index e22ff79a3bd8..9c22aff144fd 100644
--- a/mingw-w64-crt/stdio/mingw_pformat.c
+++ b/mingw-w64-crt/stdio/mingw_pformat.c
@@ -3001,6 +3001,16 @@ __pformat (int flags, void *dest, int max, const APICHAR 
*fmt, va_list argv)
             state = PFORMAT_END;
             break;
 
+          case 'w':
+            /*
+             * Identify the appropriate argument as a wide
+             * character or wide string when associated with
+             * `%c`, `%C`, `%s' or `%S`.
+             */
+            length = PFORMAT_LENGTH_LONG;
+            state = PFORMAT_END;
+            break;
+
           case 'L':
             /*
              * Identify the appropriate argument as a `long double',
-- 
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