mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 03:50:21 +00:00
kernel: Use the WinXP method for comparing strings with embedded NULLs. Update tests.
This commit is contained in:
parent
1644974491
commit
22d7f14144
|
@ -928,11 +928,21 @@ static void test_CompareStringA(void)
|
|||
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 7, "aLuZkUtZ\0A", 10);
|
||||
ok(ret == 1, "aLuZkUtZ vs aLuZkUtZ\\0A expected 1, got %d\n", ret);
|
||||
|
||||
/* WinXP handles embedded NULLs differently than earlier versions */
|
||||
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLuZkUtZ", 8, "aLuZkUtZ\0A", 10);
|
||||
ok(ret == 2, "aLuZkUtZ vs aLuZkUtZ\\0A expected 2, got %d\n", ret);
|
||||
ok(ret == 1 || ret == 2, "aLuZkUtZ vs aLuZkUtZ\\0A expected 1 or 2, got %d\n", ret);
|
||||
|
||||
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, "aLu\0ZkUtZ", 8, "aLu\0ZkUtZ\0A", 10);
|
||||
ok(ret == 2, "aLu\\0ZkUtZ vs aLu\\0ZkUtZ\\0A expected 2, got %d\n", ret);
|
||||
ok(ret == 1 || ret == 2, "aLu\\0ZkUtZ vs aLu\\0ZkUtZ\\0A expected 1 or 2, got %d\n", ret);
|
||||
|
||||
ret = CompareStringA(lcid, 0, "a\0b", -1, "a", -1);
|
||||
ok(ret == 2, "a vs a expected 2, got %d\n", ret);
|
||||
|
||||
ret = CompareStringA(lcid, 0, "a\0b", 4, "a", 2);
|
||||
ok(ret == 3, "a\\0b vs a expected 3, got %d\n", ret);
|
||||
|
||||
ret = CompareStringA(lcid, 0, "\1\0\2", 4, "\1\0\1", 4);
|
||||
todo_wine ok(ret != 2, "\\1\\0\\2 vs \\1\\0\\1 expected unequal\n");
|
||||
}
|
||||
|
||||
static void test_LCMapStringA(void)
|
||||
|
|
|
@ -326,9 +326,8 @@ static inline int compare_case_weights(int flags, const WCHAR *str1, int len1,
|
|||
|
||||
static inline int real_length(const WCHAR *str, int len)
|
||||
{
|
||||
int real_len = 0;
|
||||
while (len-- && *str++) real_len++;
|
||||
return real_len;
|
||||
while (len && !str[len - 1]) len--;
|
||||
return len;
|
||||
}
|
||||
|
||||
int wine_compare_string(int flags, const WCHAR *str1, int len1,
|
||||
|
|
Loading…
Reference in a new issue