Commit 4a6e69ad authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

libwine: Ignore 0 weights as described in Unicode collation algorithm.

parent 40a1a9e9
......@@ -2043,9 +2043,9 @@ static void test_CompareStringW(void)
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);
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);
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);
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);
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);
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);
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);
if (!ce1)
{
inc_str_pos(&str1, &len1, &dpos1, &dlen1);
continue;
}
ce2 = get_weight(dstr2[dpos2], type);
if (!ce2)
{
inc_str_pos(&str2, &len2, &dpos2, &dlen2);
continue;
}
if (ce1 - ce2) return ce1 - ce2;
inc_str_pos(&str1, &len1, &dpos1, &dlen1);
inc_str_pos(&str2, &len2, &dpos2, &dlen2);
}
while (len1 && !*str1)
while (len1)
{
str1++;
len1--;
if (!dlen1) dlen1 = wine_decompose(0, *str1, dstr1, 4);
ce1 = get_weight(dstr1[dpos1], type);
if (ce1) break;
inc_str_pos(&str1, &len1, &dpos1, &dlen1);
}
while (len2 && !*str2)
while (len2)
{
str2++;
len2--;
if (!dlen2) dlen2 = wine_decompose(0, *str2, dstr2, 4);
ce2 = get_weight(dstr2[dpos2], type);
if (ce2) break;
inc_str_pos(&str2, &len2, &dpos2, &dlen2);
}
return len1 - len2;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment