user32: Fix wsprintfA %C conversion.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Akihiro Sagawa 2020-02-19 23:21:35 +09:00 committed by Alexandre Julliard
parent 3b5619a8f4
commit 7cc21d0330
2 changed files with 12 additions and 4 deletions

View File

@ -111,12 +111,10 @@ static void wsprintfATest(void)
memset(buf, 0x11, sizeof(buf));
rc = wsprintfA(buf, testcase[i].fmt, testcase[i].input);
todo_wine_if( i == 7 )
ok(rc == testcase[i].rc,
"%u: expected %d, got %d\n",
i, testcase[i].rc, rc);
todo_wine_if( i == 7 || i == 8 || i == 9 )
ok(!strcmp(buf, testcase[i].str),
"%u: expected %s, got %s\n",
i, wine_dbgstr_a(testcase[i].str), wine_dbgstr_an(buf, rc));

View File

@ -255,8 +255,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)
@ -387,7 +390,14 @@ static INT wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, __ms_va_list arg
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;