Akihiro Sagawa : shlwapi: Fix wnsprintfA/wvnsprintfA %C conversion.
Alexandre Julliard
julliard at winehq.org
Wed Feb 19 15:35:48 CST 2020
Module: wine
Branch: master
Commit: 5ddca3dc0f920c29d8ef3a03dafb9918526daebf
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5ddca3dc0f920c29d8ef3a03dafb9918526daebf
Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date: Wed Feb 19 23:21:37 2020 +0900
shlwapi: Fix wnsprintfA/wvnsprintfA %C conversion.
Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shlwapi/wsprintf.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/shlwapi/wsprintf.c b/dlls/shlwapi/wsprintf.c
index f2e5f0ace1..baf5ea601a 100644
--- a/dlls/shlwapi/wsprintf.c
+++ b/dlls/shlwapi/wsprintf.c
@@ -254,8 +254,11 @@ static UINT WPRINTF_GetLen( WPRINTF_FORMAT *format, WPRINTF_DATA *arg,
switch(format->type)
{
case WPR_CHAR:
- case WPR_WCHAR:
return (format->precision = 1);
+ case WPR_WCHAR:
+ if (dst_is_wide) len = 1;
+ else len = WideCharToMultiByte( CP_ACP, 0, &arg->wchar_view, 1, NULL, 0, NULL, NULL );
+ return (format->precision = len);
case WPR_STRING:
if (!arg->lpcstr_view) arg->lpcstr_view = null_stringA;
if (dst_is_wide)
@@ -397,7 +400,14 @@ INT WINAPI wvnsprintfA( LPSTR buffer, INT maxlen, LPCSTR spec, __ms_va_list args
switch(format.type)
{
case WPR_WCHAR:
- *p++ = argData.wchar_view;
+ {
+ CHAR mb[5];
+ if (WideCharToMultiByte( CP_ACP, 0, &argData.wchar_view, 1, mb, sizeof(mb), NULL, NULL ))
+ {
+ memcpy( p, mb, len );
+ p += len;
+ }
+ }
break;
case WPR_CHAR:
*p++ = argData.char_view;
More information about the wine-cvs
mailing list