From 189a0e30b299816838df72c9d8a9ed707b2f0828 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Mon, 3 Apr 2017 11:52:18 -0700 Subject: [PATCH 2/3] msvcrt: Add _iswctype_l iswctype in msvcrt works differently from ntdll _BLANK returns true for these values in: 9: ntdll 20: msvcrt ntdll a0: ntdll 3000: msvcrt feff: msvcrt currently, the tables generated in Wine treate 0x9 and 0xa0 as blanks Signed-off-by: Daniel Lehman --- .../api-ms-win-crt-string-l1-1-0.spec | 2 +- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/wcs.c | 9 +++++++++ dlls/ucrtbase/tests/misc.c | 15 +++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 2 +- 11 files changed, 33 insertions(+), 9 deletions(-) diff --git a/dlls/api-ms-win-crt-string-l1-1-0/api-ms-win-crt-string-l1-1-0.spec b/dlls/api-ms-win-crt-string-l1-1-0/api-ms-win-crt-string-l1-1-0.spec index 4b08bc6..fe3ae54 100644 --- a/dlls/api-ms-win-crt-string-l1-1-0/api-ms-win-crt-string-l1-1-0.spec +++ b/dlls/api-ms-win-crt-string-l1-1-0/api-ms-win-crt-string-l1-1-0.spec @@ -25,7 +25,7 @@ @ stub _iswcntrl_l @ stub _iswcsym_l @ stub _iswcsymf_l -@ stub _iswctype_l +@ cdecl _iswctype_l(long long ptr) ucrtbase._iswctype_l @ cdecl _iswdigit_l(long ptr) ucrtbase._iswdigit_l @ stub _iswgraph_l @ stub _iswlower_l diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 45eb181..2c0f3c9 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1021,7 +1021,7 @@ @ stub _iswcntrl_l @ stub _iswcsym_l @ stub _iswcsymf_l -@ stub _iswctype_l +@ cdecl _iswctype_l(long long ptr) MSVCRT__iswctype_l @ cdecl _iswdigit_l(long ptr) MSVCRT__iswdigit_l @ stub _iswgraph_l @ stub _iswlower_l diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 25fb21b..dcaa089 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1367,7 +1367,7 @@ @ stub _iswcntrl_l @ stub _iswcsym_l @ stub _iswcsymf_l -@ stub _iswctype_l +@ cdecl _iswctype_l(long long ptr) MSVCRT__iswctype_l @ cdecl _iswdigit_l(long ptr) MSVCRT__iswdigit_l @ stub _iswgraph_l @ stub _iswlower_l diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index c779528..1701c4a 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1373,7 +1373,7 @@ @ stub _iswcntrl_l @ stub _iswcsym_l @ stub _iswcsymf_l -@ stub _iswctype_l +@ cdecl _iswctype_l(long long ptr) MSVCRT__iswctype_l @ cdecl _iswdigit_l(long ptr) MSVCRT__iswdigit_l @ stub _iswgraph_l @ stub _iswlower_l diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 8ca6c5f..023aa00 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1238,7 +1238,7 @@ @ stub _iswcntrl_l @ stub _iswcsym_l @ stub _iswcsymf_l -@ stub _iswctype_l +@ cdecl _iswctype_l(long long ptr) msvcr120._iswctype_l @ cdecl _iswdigit_l(long ptr) msvcr120._iswdigit_l @ stub _iswgraph_l @ stub _iswlower_l diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 4b51ae1..de945d5 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -693,7 +693,7 @@ @ stub _iswcntrl_l @ stub _iswcsym_l @ stub _iswcsymf_l -@ stub _iswctype_l +@ cdecl _iswctype_l(long long ptr) MSVCRT__iswctype_l @ cdecl _iswdigit_l(long ptr) MSVCRT__iswdigit_l @ stub _iswgraph_l @ stub _iswlower_l diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 9e9f73b..8b4a77c 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -671,7 +671,7 @@ @ stub _iswcntrl_l @ stub _iswcsym_l @ stub _iswcsymf_l -@ stub _iswctype_l +@ cdecl _iswctype_l(long long ptr) MSVCRT__iswctype_l @ cdecl _iswdigit_l(long ptr) MSVCRT__iswdigit_l @ stub _iswgraph_l @ stub _iswlower_l diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index ecef9b8..1a887d3 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -636,7 +636,7 @@ # stub _iswalnum_l(long ptr) @ cdecl _iswalpha_l(long ptr) MSVCRT__iswalpha_l # stub _iswcntrl_l(long ptr) -# stub _iswctype_l(long long ptr) +@ cdecl _iswctype_l(long long ptr) MSVCRT__iswctype_l @ cdecl _iswdigit_l(long ptr) MSVCRT__iswdigit_l # stub _iswgraph_l(long ptr) # stub _iswlower_l(long ptr) diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index bd7cc20..d24c858 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -28,6 +28,7 @@ #include "msvcrt.h" #include "winnls.h" #include "wtypes.h" +#include "wctype.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -1858,6 +1859,14 @@ INT CDECL MSVCRT_iswxdigit( MSVCRT_wchar_t wc ) } /********************************************************************* + * _iswctype_l (MSVCRT.@) + */ +INT CDECL MSVCRT__iswctype_l( MSVCRT_wchar_t wc, MSVCRT_wctype_t type, MSVCRT__locale_t locale ) +{ + return (get_char_typeW(wc) & 0xffff) & type; +} + +/********************************************************************* * wcscpy_s (MSVCRT.@) */ INT CDECL MSVCRT_wcscpy_s( MSVCRT_wchar_t* wcDest, MSVCRT_size_t numElement, const MSVCRT_wchar_t *wcSrc) diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c index 910a0f9..5a1f8dc 100644 --- a/dlls/ucrtbase/tests/misc.c +++ b/dlls/ucrtbase/tests/misc.c @@ -89,6 +89,7 @@ static MSVCRT_lldiv_t (CDECL *p_lldiv)(LONGLONG,LONGLONG); static int (CDECL *p__isctype)(int,int); static int (CDECL *p_isblank)(int); static int (CDECL *p__isblank_l)(int,_locale_t); +static int (CDECL *p__iswctype_l)(int,int,_locale_t); static void test__initialize_onexit_table(void) { @@ -386,6 +387,7 @@ static BOOL init(void) p__isctype = (void*)GetProcAddress(module, "_isctype"); p_isblank = (void*)GetProcAddress(module, "isblank"); p__isblank_l = (void*)GetProcAddress(module, "_isblank_l"); + p__iswctype_l = (void*)GetProcAddress(module, "_iswctype_l"); return TRUE; } @@ -484,6 +486,19 @@ static void test_isblank(void) ok(!p__isblank_l(c, NULL), "%d shouldn't be blank\n", c); } } + + for(c = 0; c <= 0xffff; c++) { + if(c == '\t' || c == ' ' || c == 0x3000 || c == 0xfeff) { + if(c == '\t') + todo_wine ok(!p__iswctype_l(c, _BLANK, NULL), "tab shouldn't be blank\n"); + else + ok(p__iswctype_l(c, _BLANK, NULL), "%d should be blank\n", c); + } else { + todo_wine_if(c == 0xa0) { + ok(!p__iswctype_l(c, _BLANK, NULL), "%d shouldn't be blank\n", c); + } + } + } } START_TEST(misc) diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 8f1284c..9c0b807 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -512,7 +512,7 @@ @ stub _iswcntrl_l @ stub _iswcsym_l @ stub _iswcsymf_l -@ stub _iswctype_l +@ cdecl _iswctype_l(long long ptr) MSVCRT__iswctype_l @ cdecl _iswdigit_l(long ptr) MSVCRT__iswdigit_l @ stub _iswgraph_l @ stub _iswlower_l -- 1.9.5