Jacek Caban : wbemprox: Fix checking for digit characters.

Alexandre Julliard julliard at winehq.org
Fri Feb 7 15:41:09 CST 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Feb  7 15:06:58 2020 +0100

wbemprox: Fix checking for digit characters.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wbemprox/builtin.c          | 6 +++---
 dlls/wbemprox/wbemprox_private.h | 5 +++++
 dlls/wbemprox/wql.y              | 4 ++--
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 1f8afb46fe..c680ae23c3 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -1694,17 +1694,17 @@ static WCHAR *convert_bios_date( const WCHAR *str )
     while (len && iswspace( p[len - 1] )) { len--; }
 
     q = p;
-    while (len && iswdigit( *q )) { q++; len--; };
+    while (len && is_digit( *q )) { q++; len--; };
     if (q - p != 2 || !len || *q != '/') return NULL;
     month = (p[0] - '0') * 10 + p[1] - '0';
 
     p = ++q; len--;
-    while (len && iswdigit( *q )) { q++; len--; };
+    while (len && is_digit( *q )) { q++; len--; };
     if (q - p != 2 || !len || *q != '/') return NULL;
     day = (p[0] - '0') * 10 + p[1] - '0';
 
     p = ++q; len--;
-    while (len && iswdigit( *q )) { q++; len--; };
+    while (len && is_digit( *q )) { q++; len--; };
     if (q - p == 4) year = (p[0] - '0') * 1000 + (p[1] - '0') * 100 + (p[2] - '0') * 10 + p[3] - '0';
     else if (q - p == 2) year = 1900 + (p[0] - '0') * 10 + p[1] - '0';
     else return NULL;
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index 9096b392e3..57ac793a4e 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -272,6 +272,11 @@ static inline WCHAR *heap_strdupAW( const char *src )
     return dst;
 }
 
+static inline BOOL is_digit(WCHAR c)
+{
+    return '0' <= c && c <= '9';
+}
+
 static const WCHAR class_processW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s',0};
 static const WCHAR class_serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e',0};
 static const WCHAR class_stdregprovW[] = {'S','t','d','R','e','g','P','r','o','v',0};
diff --git a/dlls/wbemprox/wql.y b/dlls/wbemprox/wql.y
index 0fae44da2e..f5b249aaba 100644
--- a/dlls/wbemprox/wql.y
+++ b/dlls/wbemprox/wql.y
@@ -785,7 +785,7 @@ static int get_token( const WCHAR *s, int *token )
         *token = TK_STRING;
         return i;
     case '.':
-        if (!iswdigit( s[1] ))
+        if (!is_digit( s[1] ))
         {
             *token = TK_DOT;
             return 1;
@@ -794,7 +794,7 @@ static int get_token( const WCHAR *s, int *token )
     case '0': case '1': case '2': case '3': case '4':
     case '5': case '6': case '7': case '8': case '9':
         *token = TK_INTEGER;
-        for (i = 1; iswdigit( s[i] ); i++) {}
+        for (i = 1; is_digit( s[i] ); i++) {}
         return i;
     default:
         if (!id_char[*s]) break;




More information about the wine-cvs mailing list