From 4f5a4b83b6b5df5585770c3ac1e2d28de8fe01a1 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 16 Jul 2020 14:46:57 +0200 Subject: [PATCH] msvcrt: Don't use tolowerW and toupperW in _setmbcp_l. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcrt/mbcs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 5215eff0e3c..f9868635e1f 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -209,7 +209,7 @@ int _setmbcp_l(int cp, LCID lcid, MSVCRT_pthreadmbcinfo mbcinfo) BYTE *bytes; WORD chartypes[256]; char bufA[256]; - WCHAR bufW[256]; + WCHAR bufW[256], lowW[256], upW[256]; int charcount; int ret; int i; @@ -310,6 +310,8 @@ int _setmbcp_l(int cp, LCID lcid, MSVCRT_pthreadmbcinfo mbcinfo) ERR("MultiByteToWideChar of chars failed for cp %d, ret=%d (exp %d), error=%d\n", newcp, ret, charcount, GetLastError()); GetStringTypeW(CT_CTYPE1, bufW, charcount, chartypes); + LCMapStringW(lcid, LCMAP_LOWERCASE, bufW, charcount, lowW, charcount); + LCMapStringW(lcid, LCMAP_UPPERCASE, bufW, charcount, upW, charcount); charcount = 0; for (i = 0; i < 256; i++) @@ -318,12 +320,12 @@ int _setmbcp_l(int cp, LCID lcid, MSVCRT_pthreadmbcinfo mbcinfo) if (chartypes[charcount] & C1_UPPER) { mbcinfo->mbctype[i + 1] |= _SBUP; - bufW[charcount] = tolowerW(bufW[charcount]); + bufW[charcount] = lowW[charcount]; } else if (chartypes[charcount] & C1_LOWER) { mbcinfo->mbctype[i + 1] |= _SBLOW; - bufW[charcount] = toupperW(bufW[charcount]); + bufW[charcount] = upW[charcount]; } charcount++; }