Alexandre Julliard : include: Remove some no longer used Unicode functions.

Alexandre Julliard julliard at winehq.org
Wed Dec 2 15:21:06 CST 2020


Module: wine
Branch: master
Commit: 6ca76dc5e73733d7fb8212a614bf093cd49da342
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6ca76dc5e73733d7fb8212a614bf093cd49da342

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec  2 12:19:09 2020 +0100

include: Remove some no longer used Unicode functions.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/analyzer.c      |   4 +-
 dlls/mountmgr.sys/device.c  |   2 +-
 dlls/netapi32/netapi32.c    |   2 +-
 dlls/shell32/autocomplete.c |   2 +-
 dlls/winemac.drv/keyboard.c |   2 +-
 include/wine/unicode.h      | 124 ++------------------------------------------
 programs/winedbg/memory.c   |  10 +---
 7 files changed, 13 insertions(+), 133 deletions(-)

diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c
index f11388628e6..7ee8e18eff7 100644
--- a/dlls/dwrite/analyzer.c
+++ b/dlls/dwrite/analyzer.c
@@ -293,9 +293,11 @@ static inline UINT16 get_char_script(WCHAR c)
 static DWRITE_SCRIPT_ANALYSIS get_char_sa(WCHAR c)
 {
     DWRITE_SCRIPT_ANALYSIS sa;
+    WORD type;
 
+    GetStringTypeW(CT_CTYPE1, &c, 1, &type);
     sa.script = get_char_script(c);
-    sa.shapes = iscntrlW(c) || c == 0x2028 /* LINE SEPARATOR */ || c == 0x2029 /* PARAGRAPH SEPARATOR */ ?
+    sa.shapes = (type & C1_CNTRL) || c == 0x2028 /* LINE SEPARATOR */ || c == 0x2029 /* PARAGRAPH SEPARATOR */ ?
         DWRITE_SCRIPT_SHAPES_NO_VISUAL : DWRITE_SCRIPT_SHAPES_DEFAULT;
     return sa;
 }
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index ed345d110a4..c4e30aa1f33 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -2086,7 +2086,7 @@ static void create_port_devices( DRIVER_OBJECT *driver )
         if (type != REG_SZ || strncmpiW( port, port_prefix, 3 ))
             continue;
 
-        n = atolW( port  + 3 );
+        n = atoiW( port  + 3 );
         if (n < 1 || n >= MAX_PORTS)
             continue;
 
diff --git a/dlls/netapi32/netapi32.c b/dlls/netapi32/netapi32.c
index 4cbd02f9d3d..2e2ac84a49c 100644
--- a/dlls/netapi32/netapi32.c
+++ b/dlls/netapi32/netapi32.c
@@ -3621,7 +3621,7 @@ DWORD WINAPI DavGetUNCFromHTTPPath(const WCHAR *http_path, WCHAR *buf, DWORD *bu
     if (*p == ':')
     {
         port = ++p;
-        while (*p && isdigitW(*p)) { p++; len_port++; };
+        while (*p >= '0' && *p <= '9') { p++; len_port++; };
         if (len_port == 2 && !ssl && !memcmp( port, port80W, sizeof(port80W) )) port = NULL;
         else if (len_port == 3 && ssl && !memcmp( port, port443W, sizeof(port443W) )) port = NULL;
         path = p;
diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index f0777ff1398..ac97527852d 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -799,7 +799,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
             This->no_fwd_char = '\0';
 
             /* Don't autocomplete at all on most control characters */
-            if (iscntrlW(wParam) && !(wParam >= '\b' && wParam <= '\r'))
+            if (wParam < 32 && !(wParam >= '\b' && wParam <= '\r'))
                 break;
 
             ret = CallWindowProcW(This->wpOrigEditProc, hwnd, uMsg, wParam, lParam);
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
index bb408cb20c5..45770b3125b 100644
--- a/dlls/winemac.drv/keyboard.c
+++ b/dlls/winemac.drv/keyboard.c
@@ -1242,7 +1242,7 @@ INT CDECL macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size)
                                     0, &deadKeyState, size - 1, &len, (UniChar*)buffer);
             if (status != noErr)
                 len = 0;
-            if (len && isgraphW(buffer[0]))
+            if (len && buffer[0] > 32)
                 buffer[len] = 0;
 
             vkey = thread_data->keyc2vkey[keyc];
diff --git a/include/wine/unicode.h b/include/wine/unicode.h
index 7a9e07fa1bc..d29a371fe53 100644
--- a/include/wine/unicode.h
+++ b/include/wine/unicode.h
@@ -28,18 +28,10 @@
 #include <winnls.h>
 #include <winternl.h>
 
-#ifdef __WINE_WINE_TEST_H
-#error This file should not be used in Wine tests
-#endif
-
 #ifdef __WINE_USE_MSVCRT
 #error This file should not be used with msvcrt headers
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #ifndef WINE_UNICODE_INLINE
 #define WINE_UNICODE_INLINE static FORCEINLINE
 #endif
@@ -54,72 +46,13 @@ WINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch )
     return RtlUpcaseUnicodeChar( ch );
 }
 
-/* the character type contains the C1_* flags in the low 12 bits */
-/* and the C2_* type in the high 4 bits */
-WINE_UNICODE_INLINE unsigned short get_char_typeW( WCHAR ch )
-{
-    unsigned short type;
-    GetStringTypeW( CT_CTYPE1, &ch, 1, &type );
-    return type;
-}
-
-WINE_UNICODE_INLINE int iscntrlW( WCHAR wc )
-{
-    return get_char_typeW(wc) & C1_CNTRL;
-}
-
-WINE_UNICODE_INLINE int ispunctW( WCHAR wc )
-{
-    return get_char_typeW(wc) & C1_PUNCT;
-}
-
 WINE_UNICODE_INLINE int isspaceW( WCHAR wc )
 {
-    return get_char_typeW(wc) & C1_SPACE;
-}
-
-WINE_UNICODE_INLINE int isdigitW( WCHAR wc )
-{
-    return get_char_typeW(wc) & C1_DIGIT;
-}
-
-WINE_UNICODE_INLINE int isxdigitW( WCHAR wc )
-{
-    return get_char_typeW(wc) & C1_XDIGIT;
-}
-
-WINE_UNICODE_INLINE int islowerW( WCHAR wc )
-{
-    return get_char_typeW(wc) & C1_LOWER;
-}
-
-WINE_UNICODE_INLINE int isupperW( WCHAR wc )
-{
-    return get_char_typeW(wc) & C1_UPPER;
-}
-
-WINE_UNICODE_INLINE int isalnumW( WCHAR wc )
-{
-    return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
-}
-
-WINE_UNICODE_INLINE int isalphaW( WCHAR wc )
-{
-    return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER);
-}
-
-WINE_UNICODE_INLINE int isgraphW( WCHAR wc )
-{
-    return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
-}
-
-WINE_UNICODE_INLINE int isprintW( WCHAR wc )
-{
-    return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
+    unsigned short type;
+    GetStringTypeW( CT_CTYPE1, &wc, 1, &type );
+    return type & C1_SPACE;
 }
 
-/* some useful string manipulation routines */
-
 WINE_UNICODE_INLINE unsigned int strlenW( const WCHAR *str )
 {
     const WCHAR *s = str;
@@ -134,9 +67,6 @@ WINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src )
     return dst;
 }
 
-/* strncpy doesn't do what you think, don't use it */
-#define strncpyW(d,s,n) error do_not_use_strncpyW_use_lstrcpynW_or_memcpy_instead
-
 WINE_UNICODE_INLINE int strcmpW( const WCHAR *str1, const WCHAR *str2 )
 {
     while (*str1 && (*str1 == *str2)) { str1++; str2++; }
@@ -175,20 +105,6 @@ WINE_UNICODE_INLINE WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept )
     return NULL;
 }
 
-WINE_UNICODE_INLINE size_t strspnW( const WCHAR *str, const WCHAR *accept )
-{
-    const WCHAR *ptr;
-    for (ptr = str; *ptr; ptr++) if (!strchrW( accept, *ptr )) break;
-    return ptr - str;
-}
-
-WINE_UNICODE_INLINE size_t strcspnW( const WCHAR *str, const WCHAR *reject )
-{
-    const WCHAR *ptr;
-    for (ptr = str; *ptr; ptr++) if (strchrW( reject, *ptr )) break;
-    return ptr - str;
-}
-
 WINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str )
 {
     WCHAR *ret;
@@ -196,13 +112,6 @@ WINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str )
     return ret;
 }
 
-WINE_UNICODE_INLINE WCHAR *struprW( WCHAR *str )
-{
-    WCHAR *ret;
-    for (ret = str; *str; str++) *str = toupperW(*str);
-    return ret;
-}
-
 WINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
 {
     const WCHAR *end;
@@ -210,14 +119,6 @@ WINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
     return NULL;
 }
 
-WINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n )
-{
-    const WCHAR *end;
-    WCHAR *ret = NULL;
-    for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = (WCHAR *)(ULONG_PTR)ptr;
-    return ret;
-}
-
 WINE_UNICODE_INLINE int strcmpiW( const WCHAR *str1, const WCHAR *str2 )
 {
     for (;;)
@@ -237,14 +138,6 @@ WINE_UNICODE_INLINE int strncmpiW( const WCHAR *str1, const WCHAR *str2, int n )
     return ret;
 }
 
-WINE_UNICODE_INLINE int memicmpW( const WCHAR *str1, const WCHAR *str2, int n )
-{
-    int ret = 0;
-    for ( ; n > 0; n--, str1++, str2++)
-        if ((ret = tolowerW(*str1) - tolowerW(*str2))) break;
-    return ret;
-}
-
 WINE_UNICODE_INLINE WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
 {
     while (*str)
@@ -350,14 +243,9 @@ WINE_UNICODE_INLINE ULONG strtoulW( LPCWSTR s, LPWSTR *end, INT base )
     return negative ? -ret : ret;
 }
 
-WINE_UNICODE_INLINE long int atolW( const WCHAR *str )
-{
-    return strtolW( str, (WCHAR **)0, 10 );
-}
-
 WINE_UNICODE_INLINE int atoiW( const WCHAR *str )
 {
-    return (int)atolW( str );
+    return (int)strtolW( str, (WCHAR **)0, 10 );
 }
 
 NTSYSAPI int __cdecl _vsnwprintf(WCHAR*,size_t,const WCHAR*,__ms_va_list);
@@ -384,8 +272,4 @@ static inline int WINAPIV sprintfW( WCHAR *str, const WCHAR *format, ...)
 
 #undef WINE_UNICODE_INLINE
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif  /* __WINE_WINE_UNICODE_H */
diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c
index c9b97686aab..8cc039a6899 100644
--- a/programs/winedbg/memory.c
+++ b/programs/winedbg/memory.c
@@ -394,15 +394,9 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
              */
             if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
         print_char:
-            if (size == 1 && isprint((char)val_int))
+            if ((size == 1 && isprint((char)val_int)) ||
+                 (size == 2 && val_int < 127 && isprint((char)val_int)))
                 dbg_printf("'%c'", (char)val_int);
-            else if (size == 2 && isprintW((WCHAR)val_int))
-            {
-                WCHAR   wch = (WCHAR)val_int;
-                dbg_printf("'");
-                dbg_outputW(&wch, 1);
-                dbg_printf("'");
-            }
             else
                 dbg_printf("%d", (int)val_int);
             break;




More information about the wine-cvs mailing list