libwine: Ignore 0 weights as described in Unicode collation algorithm.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
40a1a9e9a2
commit
4a6e69ad3a
|
@ -2043,9 +2043,9 @@ static void test_CompareStringW(void)
|
||||||
ok(ret == CSTR_GREATER_THAN, "expected CSTR_GREATER_THAN, got %d\n", ret);
|
ok(ret == CSTR_GREATER_THAN, "expected CSTR_GREATER_THAN, got %d\n", ret);
|
||||||
|
|
||||||
ret = CompareStringW(CP_ACP, 0, ABC_EE, 4, A_ACUTE_BC, 4);
|
ret = CompareStringW(CP_ACP, 0, ABC_EE, 4, A_ACUTE_BC, 4);
|
||||||
todo_wine ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret);
|
ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret);
|
||||||
ret = CompareStringW(CP_ACP, 0, ABC_EE, 4, A_ACUTE_BC_DECOMP, 5);
|
ret = CompareStringW(CP_ACP, 0, ABC_EE, 4, A_ACUTE_BC_DECOMP, 5);
|
||||||
todo_wine ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret);
|
ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret);
|
||||||
ret = CompareStringW(CP_ACP, 0, A_ACUTE_BC, 4, A_ACUTE_BC_DECOMP, 5);
|
ret = CompareStringW(CP_ACP, 0, A_ACUTE_BC, 4, A_ACUTE_BC_DECOMP, 5);
|
||||||
ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
|
ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
|
||||||
|
|
||||||
|
@ -2057,9 +2057,9 @@ static void test_CompareStringW(void)
|
||||||
ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
|
ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
|
||||||
|
|
||||||
ret = CompareStringW(CP_ACP, 0, ABC_EE, 4, A_NULL_BC, 4);
|
ret = CompareStringW(CP_ACP, 0, ABC_EE, 4, A_NULL_BC, 4);
|
||||||
todo_wine ok(ret == CSTR_EQUAL, "expected CSTR_LESS_THAN, got %d\n", ret);
|
ok(ret == CSTR_EQUAL, "expected CSTR_LESS_THAN, got %d\n", ret);
|
||||||
ret = CompareStringW(CP_ACP, NORM_IGNORENONSPACE, ABC_EE, 4, A_NULL_BC, 4);
|
ret = CompareStringW(CP_ACP, NORM_IGNORENONSPACE, ABC_EE, 4, A_NULL_BC, 4);
|
||||||
todo_wine ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
|
ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
|
||||||
|
|
||||||
ret = CompareStringW(CP_ACP, 0, A_NULL_BC, 4, A_ACUTE_BC, 4);
|
ret = CompareStringW(CP_ACP, 0, A_NULL_BC, 4, A_ACUTE_BC, 4);
|
||||||
ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret);
|
ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret);
|
||||||
|
|
|
@ -245,22 +245,38 @@ static inline int compare_weights(int flags, const WCHAR *str1, int len1,
|
||||||
}
|
}
|
||||||
|
|
||||||
ce1 = get_weight(dstr1[dpos1], type);
|
ce1 = get_weight(dstr1[dpos1], type);
|
||||||
|
if (!ce1)
|
||||||
|
{
|
||||||
|
inc_str_pos(&str1, &len1, &dpos1, &dlen1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ce2 = get_weight(dstr2[dpos2], type);
|
ce2 = get_weight(dstr2[dpos2], type);
|
||||||
|
if (!ce2)
|
||||||
|
{
|
||||||
|
inc_str_pos(&str2, &len2, &dpos2, &dlen2);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ce1 - ce2) return ce1 - ce2;
|
if (ce1 - ce2) return ce1 - ce2;
|
||||||
|
|
||||||
inc_str_pos(&str1, &len1, &dpos1, &dlen1);
|
inc_str_pos(&str1, &len1, &dpos1, &dlen1);
|
||||||
inc_str_pos(&str2, &len2, &dpos2, &dlen2);
|
inc_str_pos(&str2, &len2, &dpos2, &dlen2);
|
||||||
}
|
}
|
||||||
while (len1 && !*str1)
|
while (len1)
|
||||||
{
|
{
|
||||||
str1++;
|
if (!dlen1) dlen1 = wine_decompose(0, *str1, dstr1, 4);
|
||||||
len1--;
|
|
||||||
|
ce1 = get_weight(dstr1[dpos1], type);
|
||||||
|
if (ce1) break;
|
||||||
|
inc_str_pos(&str1, &len1, &dpos1, &dlen1);
|
||||||
}
|
}
|
||||||
while (len2 && !*str2)
|
while (len2)
|
||||||
{
|
{
|
||||||
str2++;
|
if (!dlen2) dlen2 = wine_decompose(0, *str2, dstr2, 4);
|
||||||
len2--;
|
|
||||||
|
ce2 = get_weight(dstr2[dpos2], type);
|
||||||
|
if (ce2) break;
|
||||||
|
inc_str_pos(&str2, &len2, &dpos2, &dlen2);
|
||||||
}
|
}
|
||||||
return len1 - len2;
|
return len1 - len2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue