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>
This commit is contained in:
parent
0a2635611a
commit
35886486d4
|
@ -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,
|
||||||
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';
|
||||||
|
|
Loading…
Reference in New Issue