Akihiro Sagawa : ntdll: Avoid using isdigit() for WCHARs.

Alexandre Julliard julliard at winehq.org
Wed May 17 15:58:29 CDT 2017


Module: wine
Branch: master
Commit: ea6e51744fa533e64d9c8257f1cc892ff43c741e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ea6e51744fa533e64d9c8257f1cc892ff43c741e

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Wed May 17 21:35:39 2017 +0900

ntdll: Avoid using isdigit() for WCHARs.

Found with Coccinelle.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/printf.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/printf.c b/dlls/ntdll/printf.c
index 65dc62d..b6b8b6c 100644
--- a/dlls/ntdll/printf.c
+++ b/dlls/ntdll/printf.c
@@ -410,6 +410,11 @@ static void pf_fixup_exponent( char *buf )
     }
 }
 
+static inline BOOL isDigit(WCHAR c)
+{
+    return c >= '0' && c <= '9';
+}
+
 /*********************************************************************
  *  pf_vsnprintf  (INTERNAL)
  *
@@ -490,7 +495,7 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valis
             }
             p++;
         }
-        else while( isdigit(*p) )
+        else while( isDigit(*p) )
         {
             flags.FieldLength *= 10;
             flags.FieldLength += *p++ - '0';
@@ -507,7 +512,7 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valis
                 flags.Precision = va_arg( valist, int );
                 p++;
             }
-            else while( isdigit(*p) )
+            else while( isDigit(*p) )
             {
                 flags.Precision *= 10;
                 flags.Precision += *p++ - '0';
@@ -531,7 +536,7 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valis
                 }
                 else if( *(p+1) == '3' && *(p+2) == '2' )
                     p += 3;
-                else if( isdigit(*(p+1)) || *(p+1) == 0 )
+                else if( isDigit(*(p+1)) || *(p+1) == 0 )
                     break;
                 else
                     p++;




More information about the wine-cvs mailing list