diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 1c632cc4356..81e74531eab 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -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); diff --git a/libs/port/sortkey.c b/libs/port/sortkey.c index 5d83fcd5945..f62289bcdc5 100644 --- a/libs/port/sortkey.c +++ b/libs/port/sortkey.c @@ -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; }