Module: wine Branch: master Commit: 068a419e4219c5bb5d8156ff9177676d9c174021 URL: https://source.winehq.org/git/wine.git/?a=commit;h=068a419e4219c5bb5d8156ff9...
Author: Piotr Caban piotr@codeweavers.com Date: Tue Jul 21 12:21:20 2020 +0200
msvcrt: Don't use get_char_typeW in _iswctype_l.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/msvcrt.h | 1 + dlls/msvcrt/wcs.c | 14 ++++++++++++-- dlls/ucrtbase/tests/misc.c | 10 ++++------ 3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 9395b7ecac..7e854704b1 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -314,6 +314,7 @@ extern unsigned int MSVCRT___lc_codepage; extern int MSVCRT___lc_collate_cp; extern WORD MSVCRT__ctype [257]; extern BOOL initial_locale DECLSPEC_HIDDEN; +extern WORD *MSVCRT__pwctype;
void msvcrt_set_errno(int) DECLSPEC_HIDDEN; #if _MSVCR_VER >= 80 diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 5188d4f860..4be3de5b2d 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -1919,7 +1919,17 @@ MSVCRT_size_t CDECL MSVCRT_wcrtomb( char *dst, MSVCRT_wchar_t ch, MSVCRT_mbstate */ INT CDECL MSVCRT__iswctype_l( MSVCRT_wchar_t wc, MSVCRT_wctype_t type, MSVCRT__locale_t locale ) { - return (get_char_typeW(wc) & 0xffff) & type; + WORD ct; + + if (wc == MSVCRT_WEOF) return 0; + if (wc < 256) return MSVCRT__pwctype[wc] & type; + + if (!GetStringTypeW(CT_CTYPE1, &wc, 1, &ct)) + { + ERR("GetStringTypeW failed for %x\n", wc); + return 0; + } + return ct & type; }
/********************************************************************* @@ -1927,7 +1937,7 @@ INT CDECL MSVCRT__iswctype_l( MSVCRT_wchar_t wc, MSVCRT_wctype_t type, MSVCRT__l */ INT CDECL MSVCRT_iswctype( MSVCRT_wchar_t wc, MSVCRT_wctype_t type ) { - return (get_char_typeW(wc) & 0xfff) & type; + return MSVCRT__iswctype_l( wc, type, NULL ); }
/********************************************************************* diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c index e4928b194f..a5f78925fd 100644 --- a/dlls/ucrtbase/tests/misc.c +++ b/dlls/ucrtbase/tests/misc.c @@ -557,17 +557,15 @@ static void test_isblank(void) for(c = 0; c <= 0xffff; c++) { if(c == '\t' || c == ' ' || c == 0x3000 || c == 0xfeff) { if(c == '\t') - todo_wine ok(!_iswctype_l(c, _BLANK, NULL), "tab shouldn't be blank\n"); + ok(!_iswctype_l(c, _BLANK, NULL), "tab shouldn't be blank\n"); else ok(_iswctype_l(c, _BLANK, NULL), "%d should be blank\n", c); ok(iswblank(c), "%d should be blank\n", c); ok(_iswblank_l(c, NULL), "%d should be blank\n", c); } else { - todo_wine_if(c == 0xa0) { - ok(!_iswctype_l(c, _BLANK, NULL), "%d shouldn't be blank\n", c); - ok(!iswblank(c), "%d shouldn't be blank\n", c); - ok(!_iswblank_l(c, NULL), "%d shouldn't be blank\n", c); - } + ok(!_iswctype_l(c, _BLANK, NULL), "%d shouldn't be blank\n", c); + ok(!iswblank(c), "%d shouldn't be blank\n", c); + ok(!_iswblank_l(c, NULL), "%d shouldn't be blank\n", c); } } }