When not provided, instead of calling get_locinfo on every character. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/msvcrt/wcs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 793c37a343f..41c70fdad12 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 = {}; MSVCRT_wchar_t* ptr = str; if (!str || !n) @@ -364,13 +365,19 @@ 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) break; *ptr = MSVCRT__towupper_l(*ptr, locale); ptr++; } + free_locale_noalloc(&tmp); + if (!*ptr) return 0; + /* 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'; -- 2.29.2