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

Signed-off-by: Brendan McGrath <brendan@redmandi.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Brendan McGrath 2019-03-05 20:58:32 +11:00 committed by Alexandre Julliard
parent 7c1e0ef736
commit 5d577ae9ea
2 changed files with 2 additions and 3 deletions

View File

@ -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 */

View File

@ -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 */