Brendan McGrath : libwine: get_sortkey to return consistent length with and without dstlen.

Alexandre Julliard julliard at winehq.org
Tue Mar 5 15:06:31 CST 2019


Module: wine
Branch: master
Commit: 5d577ae9ea2b8f8f70dcad3d3d4f4bf964bb9de9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5d577ae9ea2b8f8f70dcad3d3d4f4bf964bb9de9

Author: Brendan McGrath <brendan at redmandi.com>
Date:   Tue Mar  5 20:58:32 2019 +1100

libwine: get_sortkey to return consistent length with and without dstlen.

Signed-off-by: Brendan McGrath <brendan at redmandi.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/locale.c | 1 -
 libs/wine/sortkey.c          | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index e11fe1b..cf781e5 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -2366,7 +2366,6 @@ static void test_LCMapStringA(void)
     ret2 = LCMapStringA(LOCALE_USER_DEFAULT, LCMAP_SORTKEY,
                        upper_case, lstrlenA(upper_case), NULL, 0);
     ok(ret2, "LCMapStringA must succeed\n");
-    todo_wine
     ok(ret == ret2, "lengths of sort keys must be equal (%d vs %d)\n", ret, ret2);
 
     /* test LCMAP_SORTKEY | NORM_IGNORECASE */
diff --git a/libs/wine/sortkey.c b/libs/wine/sortkey.c
index ef44889..c61a7e5 100644
--- a/libs/wine/sortkey.c
+++ b/libs/wine/sortkey.c
@@ -79,8 +79,8 @@ int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dst
     }
 
     if (!dstlen) /* compute length */
-        /* 4 * '\1' + 1 * '\0' + key length */
-        return key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1;
+        /* 4 * '\1' + key length */
+        return key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4;
 
     if (dstlen < key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1)
         return 0; /* overflow */




More information about the wine-cvs mailing list