Commit f6ced249 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

msi: Avoid using isspace()/isdigit() for WCHARs.

Found with Coccinelle. Signed-off-by: 's avatarAkihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: 's avatarHans Leidekker <hans@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent bb6a65e0
...@@ -187,6 +187,21 @@ static const char isIdChar[] = { ...@@ -187,6 +187,21 @@ static const char isIdChar[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* Fx */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* Fx */
}; };
/*
** WCHAR safe version of isdigit()
*/
static inline int isDigit(WCHAR c)
{
return c >= '0' && c <= '9';
}
/*
** WCHAR safe version of isspace(), except '\r'
*/
static inline int isSpace(WCHAR c)
{
return c == ' ' || c == '\t' || c == '\n' || c == '\f';
}
/* /*
** Return the length of the token that begins at z[0]. Return ** Return the length of the token that begins at z[0]. Return
...@@ -199,7 +214,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip){ ...@@ -199,7 +214,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip){
*skip = 0; *skip = 0;
switch( *z ){ switch( *z ){
case ' ': case '\t': case '\n': case '\f': case ' ': case '\t': case '\n': case '\f':
for(i=1; isspace(z[i]) && z[i] != '\r'; i++){} for(i=1; isSpace(z[i]); i++){}
*tokenType = TK_SPACE; *tokenType = TK_SPACE;
return i; return i;
case '-': case '-':
...@@ -265,7 +280,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip){ ...@@ -265,7 +280,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip){
return i; return i;
} }
case '.': case '.':
if( !isdigit(z[1]) ){ if( !isDigit(z[1]) ){
*tokenType = TK_DOT; *tokenType = TK_DOT;
return 1; return 1;
} }
...@@ -273,7 +288,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip){ ...@@ -273,7 +288,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip){
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
*tokenType = TK_INTEGER; *tokenType = TK_INTEGER;
for(i=1; isdigit(z[i]); i++){} for(i=1; isDigit(z[i]); i++){}
return i; return i;
case '[': case '[':
for(i=1; z[i] && z[i-1]!=']'; i++){} for(i=1; z[i] && z[i-1]!=']'; i++){}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment