Alexandre Julliard : kernel32: Avoid using wctype functions.

Alexandre Julliard julliard at winehq.org
Wed Apr 1 15:50:58 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Apr  1 10:30:17 2020 +0200

kernel32: Avoid using wctype functions.

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

---

 dlls/kernel32/editline.c   | 5 ++++-
 dlls/kernel32/format_msg.c | 4 ++--
 dlls/kernel32/profile.c    | 4 ++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/editline.c b/dlls/kernel32/editline.c
index e3d52ccc1a..489960aba6 100644
--- a/dlls/kernel32/editline.c
+++ b/dlls/kernel32/editline.c
@@ -362,7 +362,10 @@ static void WCEL_SaveYank(WCEL_Context* ctx, int beg, int end)
  */
 static inline BOOL WCEL_iswalnum(WCHAR wc)
 {
-    return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
+    WORD type;
+
+    GetStringTypeW( CT_CTYPE1, &wc, 1, &type );
+    return type & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
 }
 
 static int WCEL_GetLeftWordTransition(WCEL_Context* ctx, int ofs)
diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c
index 6a0dc5bd6b..f29c88fd38 100644
--- a/dlls/kernel32/format_msg.c
+++ b/dlls/kernel32/format_msg.c
@@ -184,7 +184,7 @@ static LPCWSTR format_insert( BOOL unicode_caller, int insert, LPCWSTR format,
         }
         else *p++ = *format++;
     }
-    while (isdigitW(*format)) *p++ = *format++;
+    while (*format >= '0' && *format <= '9') *p++ = *format++;
 
     if (*format == '.')
     {
@@ -196,7 +196,7 @@ static LPCWSTR format_insert( BOOL unicode_caller, int insert, LPCWSTR format,
             format++;
         }
         else
-            while (isdigitW(*format)) *p++ = *format++;
+            while (*format >= '0' && *format <= '9') *p++ = *format++;
     }
 
     /* replicate MS bug: drop an argument when using va_list with width/precision */
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index 434728c267..f7d64f16a5 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -270,8 +270,8 @@ static void PROFILE_Free( PROFILESECTION *section )
 /* returns TRUE if a whitespace character, else FALSE */
 static inline BOOL PROFILE_isspaceW(WCHAR c)
 {
-	/* ^Z (DOS EOF) is a space too  (found on CD-ROMs) */
-	return isspaceW(c) || c == 0x1a;
+    /* ^Z (DOS EOF) is a space too  (found on CD-ROMs) */
+    return (c >= 0x09 && c <= 0x0d) || c == 0x1a || c == 0x20;
 }
 
 static inline ENCODING PROFILE_DetectTextEncoding(const void * buffer, int * len)




More information about the wine-cvs mailing list