From 578d489ca1e030b6713f6dc1fcaa183bea9e94cd Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Mon, 3 Apr 2017 09:24:40 -0700 Subject: [PATCH 1/3] ucrtbase: Add _isblank_l isblank treats tab differently from ctype(BLANK) Signed-off-by: Daniel Lehman --- .../api-ms-win-crt-string-l1-1-0.spec | 4 ++-- dlls/msvcr120/msvcr120.spec | 4 ++-- dlls/msvcr120_app/msvcr120_app.spec | 4 ++-- dlls/msvcrt/ctype.c | 16 +++++++++++++ dlls/ucrtbase/tests/misc.c | 27 ++++++++++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 4 ++-- 6 files changed, 51 insertions(+), 8 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 0095feb..4b08bc6 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 @@ -7,7 +7,7 @@ @ stub __wcsncnt @ cdecl _isalnum_l(long ptr) ucrtbase._isalnum_l @ cdecl _isalpha_l(long ptr) ucrtbase._isalpha_l -@ stub _isblank_l +@ cdecl _isblank_l(long ptr) ucrtbase._isblank_l @ cdecl _iscntrl_l(long ptr) ucrtbase._iscntrl_l @ cdecl _isctype(long long) ucrtbase._isctype @ cdecl _isctype_l(long long ptr) ucrtbase._isctype_l @@ -100,7 +100,7 @@ @ cdecl is_wctype(long long) ucrtbase.is_wctype @ cdecl isalnum(long) ucrtbase.isalnum @ cdecl isalpha(long) ucrtbase.isalpha -@ stub isblank +@ cdecl isblank(long) ucrtbase.isblank @ cdecl iscntrl(long) ucrtbase.iscntrl @ cdecl isdigit(long) ucrtbase.isdigit @ cdecl isgraph(long) ucrtbase.isgraph diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index bb14b78..c779528 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1291,7 +1291,7 @@ @ cdecl _isalnum_l(long ptr) MSVCRT__isalnum_l @ cdecl _isalpha_l(long ptr) MSVCRT__isalpha_l @ cdecl _isatty(long) MSVCRT__isatty -@ stub _isblank_l +@ cdecl _isblank_l(long ptr) MSVCRT__isblank_l @ cdecl _iscntrl_l(long ptr) MSVCRT__iscntrl_l @ cdecl _isctype(long long) MSVCRT__isctype @ cdecl _isctype_l(long long ptr) MSVCRT__isctype_l @@ -2215,7 +2215,7 @@ @ cdecl is_wctype(long long) ntdll.iswctype @ cdecl isalnum(long) MSVCRT_isalnum @ cdecl isalpha(long) MSVCRT_isalpha -@ stub isblank +@ cdecl isblank(long) MSVCRT_isblank @ cdecl iscntrl(long) MSVCRT_iscntrl @ cdecl isdigit(long) MSVCRT_isdigit @ cdecl isgraph(long) MSVCRT_isgraph diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 060438d..8ca6c5f 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1194,7 +1194,7 @@ @ cdecl _isalnum_l(long ptr) msvcr120._isalnum_l @ cdecl _isalpha_l(long ptr) msvcr120._isalpha_l @ cdecl _isatty(long) msvcr120._isatty -@ stub _isblank_l +@ cdecl _isblank_l(long ptr) msvcr120._isblank_l @ cdecl _iscntrl_l(long ptr) msvcr120._iscntrl_l @ cdecl _isctype(long long) msvcr120._isctype @ cdecl _isctype_l(long long ptr) msvcr120._isctype_l @@ -1878,7 +1878,7 @@ @ stub imaxdiv @ cdecl isalnum(long) msvcr120.isalnum @ cdecl isalpha(long) msvcr120.isalpha -@ stub isblank +@ cdecl isblank(long) msvcr120.isblank @ cdecl iscntrl(long) msvcr120.iscntrl @ cdecl isdigit(long) msvcr120.isdigit @ cdecl isgraph(long) msvcr120.isgraph diff --git a/dlls/msvcrt/ctype.c b/dlls/msvcrt/ctype.c index 8b9d14c..eb9891a 100644 --- a/dlls/msvcrt/ctype.c +++ b/dlls/msvcrt/ctype.c @@ -293,6 +293,22 @@ int CDECL MSVCRT_isxdigit(int c) } /********************************************************************* + * _isblank_l (MSVCRT.@) + */ +int CDECL MSVCRT__isblank_l(int c, MSVCRT__locale_t locale) +{ + return c == '\t' || MSVCRT__isctype_l( c, MSVCRT__BLANK, locale ); +} + +/********************************************************************* + * isblank (MSVCRT.@) + */ +int CDECL MSVCRT_isblank(int c) +{ + return c == '\t' || MSVCRT__isctype( c, MSVCRT__BLANK ); +} + +/********************************************************************* * __isascii (MSVCRT.@) */ int CDECL MSVCRT___isascii(int c) diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c index 5f1d2a1..910a0f9 100644 --- a/dlls/ucrtbase/tests/misc.c +++ b/dlls/ucrtbase/tests/misc.c @@ -86,6 +86,9 @@ static char* (CDECL *p__get_narrow_winmain_command_line)(void); static int (CDECL *p_sopen_dispatch)(const char *, int, int, int, int *, int); static int (CDECL *p_sopen_s)(int *, const char *, int, int, int); 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 void test__initialize_onexit_table(void) { @@ -380,6 +383,9 @@ static BOOL init(void) p_sopen_dispatch = (void*)GetProcAddress(module, "_sopen_dispatch"); p_sopen_s = (void*)GetProcAddress(module, "_sopen_s"); p_lldiv = (void*)GetProcAddress(module, "lldiv"); + p__isctype = (void*)GetProcAddress(module, "_isctype"); + p_isblank = (void*)GetProcAddress(module, "isblank"); + p__isblank_l = (void*)GetProcAddress(module, "_isblank_l"); return TRUE; } @@ -460,6 +466,26 @@ static void test_lldiv(void) ok(r.rem == 0x222, "rem = %x%08x\n", (INT32)(r.rem >> 32), (UINT32)r.rem); } +static void test_isblank(void) +{ + int c; + + for(c = 0; c <= 0xff; c++) { + if(c == '\t' || c == ' ') { + if(c == '\t') + ok(!p__isctype(c, _BLANK), "tab shouldn't be blank\n"); + else + ok(p__isctype(c, _BLANK), "space should be blank\n"); + ok(p_isblank(c), "%d should be blank\n", c); + ok(p__isblank_l(c, NULL), "%d should be blank\n", c); + } else { + ok(!p__isctype(c, _BLANK), "%d shouldn't be blank\n", c); + ok(!p_isblank(c), "%d shouldn't be blank\n", c); + ok(!p__isblank_l(c, NULL), "%d shouldn't be blank\n", c); + } + } +} + START_TEST(misc) { int arg_c; @@ -483,4 +509,5 @@ START_TEST(misc) test__sopen_dispatch(); test__sopen_s(); test_lldiv(); + test_isblank(); } diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index d4f3d7e..8f1284c 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -430,7 +430,7 @@ @ cdecl _isalnum_l(long ptr) MSVCRT__isalnum_l @ cdecl _isalpha_l(long ptr) MSVCRT__isalpha_l @ cdecl _isatty(long) MSVCRT__isatty -@ stub _isblank_l +@ cdecl _isblank_l(long ptr) MSVCRT__isblank_l @ cdecl _iscntrl_l(long ptr) MSVCRT__iscntrl_l @ cdecl _isctype(long long) MSVCRT__isctype @ cdecl _isctype_l(long long ptr) MSVCRT__isctype_l @@ -2349,7 +2349,7 @@ @ cdecl is_wctype(long long) ntdll.iswctype @ cdecl isalnum(long) MSVCRT_isalnum @ cdecl isalpha(long) MSVCRT_isalpha -@ stub isblank +@ cdecl isblank(long) MSVCRT_isblank @ cdecl iscntrl(long) MSVCRT_iscntrl @ cdecl isdigit(long) MSVCRT_isdigit @ cdecl isgraph(long) MSVCRT_isgraph -- 1.9.5