wbemprox: Fix checking for digit characters.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-02-07 15:06:58 +01:00 committed by Alexandre Julliard
parent c436080e8e
commit 5a44fc7b81
3 changed files with 10 additions and 5 deletions

View File

@ -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;

View File

@ -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};

View File

@ -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;