Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/msvcrt/wcs.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index ffcc7d11926..6d0e43a722e 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -100,6 +100,21 @@ static inline int msvcrt_towlower_internal(MSVCRT_wint_t c, MSVCRT_pthreadlocinf return ret; }
+static inline int msvcrt_towupper_internal(MSVCRT_wint_t c, MSVCRT_pthreadlocinfo locinfo) +{ + MSVCRT_wchar_t ret; + + if(!locinfo->lc_handle[MSVCRT_LC_CTYPE]) { + if(c >= 'a' && c <= 'z') + return c + 'A' - 'a'; + return c; + } + + if(!LCMapStringW(locinfo->lc_handle[MSVCRT_LC_CTYPE], LCMAP_UPPERCASE, &c, 1, &ret, 1)) + return c; + return ret; +} + /********************************************************************* * _towlower_l (MSVCRT.@) */ @@ -371,10 +386,15 @@ int CDECL MSVCRT__wcsupr_s_l( MSVCRT_wchar_t* str, MSVCRT_size_t n, return MSVCRT_EINVAL; }
+ if(!locale) + locinfo = get_locinfo(); + else + locinfo = locale->locinfo; + while (n--) { if (!*ptr) return 0; - *ptr = MSVCRT__towupper_l(*ptr, locale); + *ptr = msvcrt_towupper_internal(*ptr, locinfo); ptr++; }
@@ -2779,22 +2799,13 @@ MSVCRT_size_t CDECL MSVCRT_wcsnlen(const MSVCRT_wchar_t *s, MSVCRT_size_t maxlen int CDECL MSVCRT__towupper_l(MSVCRT_wint_t c, MSVCRT__locale_t locale) { MSVCRT_pthreadlocinfo locinfo; - MSVCRT_wchar_t ret;
if(!locale) locinfo = get_locinfo(); else locinfo = locale->locinfo;
- if(!locinfo->lc_handle[MSVCRT_LC_CTYPE]) { - if(c >= 'a' && c <= 'z') - return c + 'A' - 'a'; - return c; - } - - if(!LCMapStringW(locinfo->lc_handle[MSVCRT_LC_CTYPE], LCMAP_UPPERCASE, &c, 1, &ret, 1)) - return c; - return ret; + return msvcrt_towupper_internal(c, locinfo); }
/*********************************************************************