Commit 35886486 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

msvcrt: Pass temporary locale to MSVCRT__towupper_l.

When not provided, instead of calling get_locinfo on every character. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0a263561
...@@ -355,6 +355,7 @@ MSVCRT_wchar_t* CDECL MSVCRT__wcsset( MSVCRT_wchar_t* str, MSVCRT_wchar_t 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, int CDECL MSVCRT__wcsupr_s_l( MSVCRT_wchar_t* str, MSVCRT_size_t n,
MSVCRT__locale_t locale ) MSVCRT__locale_t locale )
{ {
MSVCRT__locale_tstruct tmp = {0};
MSVCRT_wchar_t* ptr = str; MSVCRT_wchar_t* ptr = str;
if (!str || !n) if (!str || !n)
...@@ -364,13 +365,22 @@ int CDECL MSVCRT__wcsupr_s_l( MSVCRT_wchar_t* str, MSVCRT_size_t n, ...@@ -364,13 +365,22 @@ int CDECL MSVCRT__wcsupr_s_l( MSVCRT_wchar_t* str, MSVCRT_size_t n,
return MSVCRT_EINVAL; return MSVCRT_EINVAL;
} }
if(!locale)
locale = get_current_locale_noalloc(&tmp);
while (n--) while (n--)
{ {
if (!*ptr) return 0; if (!*ptr)
{
free_locale_noalloc(&tmp);
return 0;
}
*ptr = MSVCRT__towupper_l(*ptr, locale); *ptr = MSVCRT__towupper_l(*ptr, locale);
ptr++; ptr++;
} }
free_locale_noalloc(&tmp);
/* MSDN claims that the function should return and set errno to /* MSDN claims that the function should return and set errno to
* ERANGE, which doesn't seem to be true based on the tests. */ * ERANGE, which doesn't seem to be true based on the tests. */
*str = '\0'; *str = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment