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>
This commit is contained in:
Piotr Caban 2020-07-21 12:21:20 +02:00 committed by Alexandre Julliard
parent d0c795596b
commit 068a419e42
3 changed files with 17 additions and 8 deletions

View File

@ -314,6 +314,7 @@ extern unsigned int MSVCRT___lc_codepage;
extern int MSVCRT___lc_collate_cp; extern int MSVCRT___lc_collate_cp;
extern WORD MSVCRT__ctype [257]; extern WORD MSVCRT__ctype [257];
extern BOOL initial_locale DECLSPEC_HIDDEN; extern BOOL initial_locale DECLSPEC_HIDDEN;
extern WORD *MSVCRT__pwctype;
void msvcrt_set_errno(int) DECLSPEC_HIDDEN; void msvcrt_set_errno(int) DECLSPEC_HIDDEN;
#if _MSVCR_VER >= 80 #if _MSVCR_VER >= 80

View File

@ -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 ) 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 ) 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 );
} }
/********************************************************************* /*********************************************************************

View File

@ -557,17 +557,15 @@ static void test_isblank(void)
for(c = 0; c <= 0xffff; c++) { for(c = 0; c <= 0xffff; c++) {
if(c == '\t' || c == ' ' || c == 0x3000 || c == 0xfeff) { if(c == '\t' || c == ' ' || c == 0x3000 || c == 0xfeff) {
if(c == '\t') 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 else
ok(_iswctype_l(c, _BLANK, NULL), "%d should be blank\n", c); ok(_iswctype_l(c, _BLANK, NULL), "%d should be blank\n", c);
ok(iswblank(c), "%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); ok(_iswblank_l(c, NULL), "%d should be blank\n", c);
} else { } else {
todo_wine_if(c == 0xa0) { ok(!_iswctype_l(c, _BLANK, 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(c), "%d shouldn't be blank\n", c); ok(!_iswblank_l(c, NULL), "%d shouldn't be blank\n", c);
ok(!_iswblank_l(c, NULL), "%d shouldn't be blank\n", c);
}
} }
} }
} }