kernelbase: Write NUL bytes to CPINFO.LeadByte for the CP_UTF7 and CP_UTF8 code pages.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2021-11-22 22:43:29 +11:00 committed by Alexandre Julliard
parent 381ea5413c
commit 4b9010d538
2 changed files with 5 additions and 9 deletions

View file

@ -3976,10 +3976,8 @@ static void test_GetCPInfo(void)
ok(ret, "GetCPInfo(CP_UTF7) error %u\n", GetLastError());
ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
for (i = 2; i < sizeof(cpinfo.LeadByte); i++)
todo_wine ok(!cpinfo.LeadByte[i], "expected NUL byte in index %u\n", i);
for (i = 0; i < sizeof(cpinfo.LeadByte); i++)
ok(!cpinfo.LeadByte[i], "expected NUL byte in index %u\n", i);
ok(cpinfo.MaxCharSize == 5, "expected 5, got 0x%x\n", cpinfo.MaxCharSize);
}
@ -3997,10 +3995,8 @@ static void test_GetCPInfo(void)
ok(ret, "GetCPInfo(CP_UTF8) error %u\n", GetLastError());
ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
for (i = 2; i < sizeof(cpinfo.LeadByte); i++)
todo_wine ok(!cpinfo.LeadByte[i], "expected NUL byte in index %u\n", i);
for (i = 0; i < sizeof(cpinfo.LeadByte); i++)
ok(!cpinfo.LeadByte[i], "expected NUL byte in index %u\n", i);
ok(cpinfo.MaxCharSize == 4 || broken(cpinfo.MaxCharSize == 3) /* win9x */,
"expected 4, got %u\n", cpinfo.MaxCharSize);
}

View file

@ -3905,7 +3905,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetCPInfo( UINT codepage, CPINFO *cpinfo )
case CP_UTF8:
cpinfo->DefaultChar[0] = 0x3f;
cpinfo->DefaultChar[1] = 0;
cpinfo->LeadByte[0] = cpinfo->LeadByte[1] = 0;
memset( cpinfo->LeadByte, 0, sizeof(cpinfo->LeadByte) );
cpinfo->MaxCharSize = (codepage == CP_UTF7) ? 5 : 4;
break;
default: