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

Alexandre Julliard julliard at winehq.org
Mon Nov 22 16:05:18 CST 2021


Module: wine
Branch: master
Commit: 4b9010d538173cd6f03a9d5f2e5e4e1cdaedf9d7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4b9010d538173cd6f03a9d5f2e5e4e1cdaedf9d7

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Mon Nov 22 22:43:29 2021 +1100

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

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/locale.c | 12 ++++--------
 dlls/kernelbase/locale.c     |  2 +-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index 4fb30eb5318..cad2577379b 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -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);
     }
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 259b9d0d18e..10f3b2698b5 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -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:




More information about the wine-cvs mailing list