Module: wine Branch: master Commit: 35886486d4aa88f49369d1196ac891e56b43c026 URL: https://source.winehq.org/git/wine.git/?a=commit;h=35886486d4aa88f49369d1196...
Author: Rémi Bernon rbernon@codeweavers.com Date: Tue Nov 10 16:58:57 2020 +0100
msvcrt: Pass temporary locale to MSVCRT__towupper_l.
When not provided, instead of calling get_locinfo on every character.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/wcs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 63f9fd472d7..fcadad77832 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -355,6 +355,7 @@ MSVCRT_wchar_t* CDECL MSVCRT__wcsset( MSVCRT_wchar_t* str, MSVCRT_wchar_t c ) int CDECL MSVCRT__wcsupr_s_l( MSVCRT_wchar_t* str, MSVCRT_size_t n, MSVCRT__locale_t locale ) { + MSVCRT__locale_tstruct tmp = {0}; MSVCRT_wchar_t* ptr = str;
if (!str || !n) @@ -364,13 +365,22 @@ int CDECL MSVCRT__wcsupr_s_l( MSVCRT_wchar_t* str, MSVCRT_size_t n, return MSVCRT_EINVAL; }
+ if(!locale) + locale = get_current_locale_noalloc(&tmp); + while (n--) { - if (!*ptr) return 0; + if (!*ptr) + { + free_locale_noalloc(&tmp); + return 0; + } *ptr = MSVCRT__towupper_l(*ptr, locale); ptr++; }
+ free_locale_noalloc(&tmp); + /* MSDN claims that the function should return and set errno to * ERANGE, which doesn't seem to be true based on the tests. */ *str = '\0';