Rémi Bernon : msvcrt: Pass temporary locale to MSVCRT__towupper_l.
Alexandre Julliard
julliard at winehq.org
Tue Nov 10 15:30:25 CST 2020
Module: wine
Branch: master
Commit: 35886486d4aa88f49369d1196ac891e56b43c026
URL: https://source.winehq.org/git/wine.git/?a=commit;h=35886486d4aa88f49369d1196ac891e56b43c026
Author: Rémi Bernon <rbernon at 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 at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at 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';
More information about the wine-cvs
mailing list