Rebase against 3c9d2cbaea2039d8ce5d8180ed231b0be6cfa072.

This commit is contained in:
Alistair Leslie-Hughes 2022-04-01 17:41:28 +11:00
parent 1e792e2d3b
commit aa58789a01
4 changed files with 38 additions and 63 deletions

View File

@ -1,4 +1,4 @@
From b7da069fa1681f8ef532fa77ff27ca6002f48dfa Mon Sep 17 00:00:00 2001
From 9b66229c8a8857e4dfbcee80698b83ca0ca7f2f9 Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Fri, 10 Apr 2020 18:47:18 +0200
Subject: [PATCH] kernelbase: Implement sortkey generation on official tables
@ -10,10 +10,10 @@ Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
2 files changed, 413 insertions(+), 123 deletions(-)
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index ad644cf5a3e..3f608996bba 100644
index 3b43dea2a2b..ac9b4da0d67 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -2564,6 +2564,13 @@ static void test_lcmapstring_unicode(lcmapstring_wrapper func_ptr, const char *f
@@ -2568,6 +2568,13 @@ static void test_lcmapstring_unicode(lcmapstring_wrapper func_ptr, const char *f
lstrlenW(symbols_stripped) + 1, ret);
ok(!lstrcmpW(buf, symbols_stripped), "%s string comparison mismatch\n", func_name);
@ -27,7 +27,7 @@ index ad644cf5a3e..3f608996bba 100644
/* test srclen = 0 */
SetLastError(0xdeadbeef);
ret = func_ptr(0, upper_case, 0, buf, ARRAY_SIZE(buf));
@@ -2993,6 +3000,135 @@ static void test_sorting(void)
@@ -3101,6 +3108,135 @@ static void test_sorting(void)
}
}
@ -163,7 +163,7 @@ index ad644cf5a3e..3f608996bba 100644
static void test_FoldStringA(void)
{
int ret, i, j;
@@ -7248,6 +7384,7 @@ START_TEST(locale)
@@ -7492,6 +7628,7 @@ START_TEST(locale)
test_locale_nls();
test_geo_name();
test_sorting();
@ -172,10 +172,10 @@ index ad644cf5a3e..3f608996bba 100644
test_EnumCalendarInfoW();
test_EnumCalendarInfoExA();
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 2f2154a0e7c..c16535a5f1a 100644
index 997c7b6f4bc..e494fe6bb48 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -2164,127 +2164,6 @@ static int wcstombs_codepage( UINT codepage, DWORD flags, const WCHAR *src, int
@@ -2857,127 +2857,6 @@ static int wcstombs_codepage( UINT codepage, DWORD flags, const WCHAR *src, int
return wcstombs_sbcs( info, src, srclen, dst, dstlen );
}
@ -303,7 +303,7 @@ index 2f2154a0e7c..c16535a5f1a 100644
/* compose a full-width katakana. return consumed source characters. */
static int compose_katakana( const WCHAR *src, int srclen, WCHAR *dst )
{
@@ -2612,6 +2491,280 @@ static int compare_weights(int flags, const WCHAR *str1, int len1,
@@ -3305,6 +3184,280 @@ static int compare_weights(int flags, const WCHAR *str1, int len1,
return len1 - len2;
}
@ -582,9 +582,9 @@ index 2f2154a0e7c..c16535a5f1a 100644
+ return 0;
+}
static const struct geoinfo *get_geoinfo_ptr( GEOID geoid )
static int compare_tzdate( const TIME_FIELDS *tf, const SYSTEMTIME *compare )
{
@@ -5302,8 +5455,8 @@ INT WINAPI DECLSPEC_HOTPATCH LCMapStringEx( const WCHAR *locale, DWORD flags, co
@@ -5759,8 +5912,8 @@ INT WINAPI DECLSPEC_HOTPATCH LCMapStringEx( const WCHAR *locale, DWORD flags, co
TRACE( "(%s,0x%08lx,%s,%d,%p,%d)\n",
debugstr_w(locale), flags, debugstr_wn(src, srclen), srclen, dst, dstlen );

View File

@ -1,18 +1,18 @@
From ef7af537a65151a43603cf10a88d91a73fe07de4 Mon Sep 17 00:00:00 2001
From 4b39a274dd286b963fc34048ea131ae1cf4dc71c Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Sun, 6 Dec 2020 20:57:16 +0100
Subject: [PATCH] kernelbase: Implement CompareString functions
---
dlls/kernel32/tests/locale.c | 33 ++--
dlls/kernelbase/locale.c | 286 +++++++++++++++++++----------------
2 files changed, 174 insertions(+), 145 deletions(-)
dlls/kernel32/tests/locale.c | 33 +++--
dlls/kernelbase/locale.c | 261 ++++++++++++++++++-----------------
2 files changed, 149 insertions(+), 145 deletions(-)
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index 320e8f79387..667a950f4f1 100644
index 0ec859363db..59929756dc6 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -1960,16 +1960,16 @@ static void test_CompareStringA(void)
@@ -1831,16 +1831,16 @@ static void test_CompareStringA(void)
"a\\0b vs a expected CSTR_EQUAL or CSTR_GREATER_THAN, got %d\n", ret);
ret = CompareStringA(lcid, 0, "\2", 2, "\1", 2);
@ -33,7 +33,7 @@ index 320e8f79387..667a950f4f1 100644
lcid = MAKELCID(MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT), SORT_DEFAULT);
@@ -2055,9 +2055,9 @@ static void test_CompareStringW(void)
@@ -1926,9 +1926,9 @@ static void test_CompareStringW(void)
ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
ret = CompareStringW(CP_ACP, NORM_IGNORENONSPACE, ABC_EE, 3, A_ACUTE_BC, 4);
@ -45,7 +45,7 @@ index 320e8f79387..667a950f4f1 100644
ret = CompareStringW(CP_ACP, NORM_IGNORENONSPACE, A_ACUTE_BC, 4, A_ACUTE_BC_DECOMP, 5);
ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
@@ -2069,12 +2069,12 @@ static void test_CompareStringW(void)
@@ -1940,12 +1940,12 @@ static void test_CompareStringW(void)
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);
ret = CompareStringW(CP_ACP, NORM_IGNORENONSPACE, A_NULL_BC, 4, A_ACUTE_BC, 4);
@ -60,7 +60,7 @@ index 320e8f79387..667a950f4f1 100644
}
struct comparestringex_test {
@@ -2111,7 +2111,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
@@ -1982,7 +1982,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
},
{ /* 5 */
"tr-TR", 0,
@ -69,7 +69,7 @@ index 320e8f79387..667a950f4f1 100644
},
/* with NORM_IGNORECASE */
{ /* 6 */
@@ -2136,7 +2136,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
@@ -2007,7 +2007,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
},
{ /* 11 */
"tr-TR", NORM_IGNORECASE,
@ -78,7 +78,7 @@ index 320e8f79387..667a950f4f1 100644
},
/* with NORM_LINGUISTIC_CASING */
{ /* 12 */
@@ -2161,7 +2161,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
@@ -2032,7 +2032,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
},
{ /* 17 */
"tr-TR", NORM_LINGUISTIC_CASING,
@ -87,7 +87,7 @@ index 320e8f79387..667a950f4f1 100644
},
/* with LINGUISTIC_IGNORECASE */
{ /* 18 */
@@ -2186,7 +2186,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
@@ -2057,7 +2057,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
},
{ /* 23 */
"tr-TR", LINGUISTIC_IGNORECASE,
@ -96,7 +96,7 @@ index 320e8f79387..667a950f4f1 100644
},
/* with NORM_LINGUISTIC_CASING | NORM_IGNORECASE */
{ /* 24 */
@@ -2211,7 +2211,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
@@ -2082,7 +2082,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
},
{ /* 29 */
"tr-TR", NORM_LINGUISTIC_CASING | NORM_IGNORECASE,
@ -105,7 +105,7 @@ index 320e8f79387..667a950f4f1 100644
},
/* with NORM_LINGUISTIC_CASING | LINGUISTIC_IGNORECASE */
{ /* 30 */
@@ -2236,7 +2236,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
@@ -2107,7 +2107,7 @@ static const struct comparestringex_test comparestringex_tests[] = {
},
{ /* 35 */
"tr-TR", NORM_LINGUISTIC_CASING | LINGUISTIC_IGNORECASE,
@ -114,7 +114,7 @@ index 320e8f79387..667a950f4f1 100644
}
};
@@ -3397,6 +3397,9 @@ static const struct sorting_test_entry unicode_sorting_tests[] =
@@ -3372,6 +3372,9 @@ static const struct sorting_test_entry unicode_sorting_tests[] =
{ L"en-US", CSTR_LESS_THAN, CSTR_LESS_THAN, 0, L"\x00dc", L"\x1ee9" },
{ L"en-US", CSTR_LESS_THAN, CSTR_LESS_THAN, 0, L"\x00fc", L"\x1ee6" },
{ L"en-US", CSTR_GREATER_THAN, CSTR_GREATER_THAN, 0, L"\x0152", L"\x00d6" },
@ -124,7 +124,7 @@ index 320e8f79387..667a950f4f1 100644
};
static void test_unicode_sorting(void)
@@ -6138,7 +6141,7 @@ static void test_FindNLSStringEx(void)
@@ -6260,7 +6263,7 @@ static void test_FindNLSStringEx(void)
{ localeW, FIND_FROMSTART, comb_s_accent1W, ARRAY_SIZE(comb_s_accent1W)-1,
comb_s_accent2W, ARRAY_SIZE(comb_s_accent2W)-1, 0, 0, 6, 1, TRUE },
{ localeW, FIND_FROMSTART, comb_q_accent1W, ARRAY_SIZE(comb_q_accent1W)-1,
@ -134,10 +134,10 @@ index 320e8f79387..667a950f4f1 100644
};
struct test_data *ptest;
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 5b27dd1d36c..01bc3357cf1 100644
index d1d461c84e9..28a69c53144 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -2371,126 +2371,6 @@ static int map_to_halfwidth( WCHAR c, WCHAR *dst, int dstlen )
@@ -3064,126 +3064,6 @@ static int map_to_halfwidth( WCHAR c, WCHAR *dst, int dstlen )
return 1;
}
@ -264,7 +264,7 @@ index 5b27dd1d36c..01bc3357cf1 100644
enum sortkey_special_script
{
SORTKEY_UNSORTABLE = 0,
@@ -2528,6 +2408,7 @@ struct sortkey_data
@@ -3221,6 +3101,7 @@ struct sortkey_data
BYTE *buffer;
int buffer_pos;
int buffer_len;
@ -272,7 +272,7 @@ index 5b27dd1d36c..01bc3357cf1 100644
};
static DWORD sortkey_get_exception(WCHAR ch, const struct sortguid *locale)
@@ -2739,7 +2620,10 @@ static void sortkey_add_diacritic_weights(struct sortkey_data *data, int flags,
@@ -3432,7 +3313,10 @@ static void sortkey_add_diacritic_weights(struct sortkey_data *data, int flags,
if (old_pos >= diacritic_start_pos)
{
if (old_pos < data->buffer_len)
@ -283,7 +283,7 @@ index 5b27dd1d36c..01bc3357cf1 100644
}
else
sortkey_add_diacritic_weight(data, info.weight_diacritic, last_weighted_pos);
@@ -2948,6 +2832,7 @@ static int sortkey_generate(int flags, const WCHAR *locale_name, const WCHAR *st
@@ -3641,6 +3525,7 @@ static int sortkey_generate(int flags, const WCHAR *locale_name, const WCHAR *st
data.buffer = buffer;
data.buffer_pos = 0;
data.buffer_len = buffer ? buffer_len : 0;
@ -291,7 +291,7 @@ index 5b27dd1d36c..01bc3357cf1 100644
if (str_len == -1)
str_len = wcslen(str);
@@ -2997,6 +2882,155 @@ static int sortkey_generate(int flags, const WCHAR *locale_name, const WCHAR *st
@@ -3690,6 +3575,130 @@ static int sortkey_generate(int flags, const WCHAR *locale_name, const WCHAR *st
return 0;
}
@ -366,7 +366,6 @@ index 5b27dd1d36c..01bc3357cf1 100644
+ diacritic_start_pos2 = data2.buffer_pos;
+ last_weighted_pos2 = data2.buffer_pos;
+ pos_weight_compare = min(data1.buffer_pos, data2.buffer_pos);
+
+ /* Diacritic weights */
+ if (!(flags & NORM_IGNORENONSPACE))
+ {
@ -394,29 +393,6 @@ index 5b27dd1d36c..01bc3357cf1 100644
+ return CSTR_LESS_THAN;
+ }
+
+ /* Case weights */
+ for (i1 = 0, i2 = 0; i1 < str1_len || i2 < str2_len; i1++, i2++)
+ {
+ int pos_weight_compare = min(data1.buffer_pos, data2.buffer_pos);
+ if (i1 < str1_len)
+ {
+ sortkey_add_case_weights(&data1, flags, str1[i1], locale);
+ }
+ if (i2 < str2_len)
+ {
+ sortkey_add_case_weights(&data2, flags, str2[i2], locale);
+ }
+
+ ret = early_exit_sortkey_comparison(&data1, &data2, pos_weight_compare);
+ if (ret != CSTR_EQUAL)
+ return ret;
+ }
+
+ if (data1.buffer_pos > data2.buffer_pos)
+ return CSTR_GREATER_THAN;
+ if (data1.buffer_pos < data2.buffer_pos)
+ return CSTR_LESS_THAN;
+
+ /* Special weights */
+ for (i1 = 0, i2 = 0; i1 < str1_len || i2 < str2_len; i1++, i2++)
+ {
@ -443,11 +419,10 @@ index 5b27dd1d36c..01bc3357cf1 100644
+ return CSTR_EQUAL;
+}
+
+
static const struct geoinfo *get_geoinfo_ptr( GEOID geoid )
static int compare_tzdate( const TIME_FIELDS *tf, const SYSTEMTIME *compare )
{
int min = 0, max = ARRAY_SIZE( geoinfodata )-1;
@@ -3471,16 +3505,8 @@ INT WINAPI CompareStringEx( const WCHAR *locale, DWORD flags, const WCHAR *str1,
static const int month_lengths[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
@@ -4166,16 +4175,8 @@ INT WINAPI CompareStringEx( const WCHAR *locale, DWORD flags, const WCHAR *str1,
if (len1 < 0) len1 = lstrlenW(str1);
if (len2 < 0) len2 = lstrlenW(str2);
@ -467,5 +442,5 @@ index 5b27dd1d36c..01bc3357cf1 100644
--
2.30.2
2.35.1

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "4bbb43d6c7ee824ff533628020c6309c4ff86c28"
echo "3c9d2cbaea2039d8ce5d8180ed231b0be6cfa072"
}
# Show version information

View File

@ -1 +1 @@
d9fdde935a153d2ce7c27cf508c499be8ed15d0b
3c9d2cbaea2039d8ce5d8180ed231b0be6cfa072