Commit aff5d2c1 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Don't use isdigit in places where only 0-9 digits are handled.

parent 52333e9c
......@@ -364,12 +364,12 @@ static double strtod_helper(const char *str, char **end, MSVCRT__locale_t locale
}
#endif
while(isdigit(*p) ||
while((*p>='0' && *p<='9') ||
(base == 16 && ((*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F')))) {
char c = *p++;
int val;
found_digit = TRUE;
if (isdigit(c))
if (c>='0' && c<='9')
val = c - '0';
else if (c >= 'a' && c <= 'f')
val = 10 + c - 'a';
......@@ -382,7 +382,7 @@ static double strtod_helper(const char *str, char **end, MSVCRT__locale_t locale
} else
d = hlp;
}
while(isdigit(*p) ||
while((*p>='0' && *p<='9') ||
(base == 16 && ((*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F')))) {
exp++;
p++;
......@@ -391,12 +391,12 @@ static double strtod_helper(const char *str, char **end, MSVCRT__locale_t locale
if(*p == *locinfo->lconv->decimal_point)
p++;
while(isdigit(*p) ||
while((*p>='0' && *p<='9') ||
(base == 16 && ((*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F')))) {
char c = *p++;
int val;
found_digit = TRUE;
if (isdigit(c))
if (c>='0' && c<='9')
val = c - '0';
else if (c >= 'a' && c <= 'f')
val = 10 + c - 'a';
......@@ -408,7 +408,7 @@ static double strtod_helper(const char *str, char **end, MSVCRT__locale_t locale
d = hlp;
exp--;
}
while(isdigit(*p) ||
while((*p>='0' && *p<='9') ||
(base == 16 && ((*p >= 'a' && *p <= 'f') || (*p >= 'A' && *p <= 'F'))))
p++;
......@@ -432,8 +432,8 @@ static double strtod_helper(const char *str, char **end, MSVCRT__locale_t locale
} else if(*p == '+')
p++;
if(isdigit(*p)) {
while(isdigit(*p)) {
if(*p>='0' && *p<='9') {
while(*p>='0' && *p<='9') {
if(e>INT_MAX/10 || (e=e*10+*p-'0')<0)
e = INT_MAX;
p++;
......@@ -925,7 +925,7 @@ __int64 CDECL MSVCRT_strtoi64_l(const char *nptr, char **endptr, int base, MSVCR
char cur = tolower(*nptr);
int v;
if(isdigit(cur)) {
if(cur>='0' && cur<='9') {
if(cur >= '0'+base)
break;
v = cur-'0';
......@@ -1128,7 +1128,7 @@ unsigned __int64 CDECL MSVCRT_strtoui64_l(const char *nptr, char **endptr, int b
char cur = tolower(*nptr);
int v;
if(isdigit(cur)) {
if(cur>='0' && cur<='9') {
if(cur >= '0'+base)
break;
v = *nptr-'0';
......
......@@ -374,7 +374,7 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
} else if(*p == '+')
p++;
while(isdigitW(*p)) {
while(*p>='0' && *p<='9') {
found_digit = TRUE;
hlp = d*10+*(p++)-'0';
if(d>MSVCRT_UI64_MAX/10 || hlp<d) {
......@@ -383,14 +383,14 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
} else
d = hlp;
}
while(isdigitW(*p)) {
while(*p>='0' && *p<='9') {
exp++;
p++;
}
if(*p == *locinfo->lconv->decimal_point)
p++;
while(isdigitW(*p)) {
while(*p>='0' && *p<='9') {
found_digit = TRUE;
hlp = d*10+*(p++)-'0';
if(d>MSVCRT_UI64_MAX/10 || hlp<d)
......@@ -399,7 +399,7 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
d = hlp;
exp--;
}
while(isdigitW(*p))
while(*p>='0' && *p<='9')
p++;
if(!found_digit) {
......@@ -418,8 +418,8 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
} else if(*p == '+')
p++;
if(isdigitW(*p)) {
while(isdigitW(*p)) {
if(*p>='0' && *p<='9') {
while(*p>='0' && *p<='9') {
if(e>INT_MAX/10 || (e=e*10+*p-'0')<0)
e = INT_MAX;
p++;
......@@ -1974,7 +1974,7 @@ __int64 CDECL MSVCRT__wcstoi64_l(const MSVCRT_wchar_t *nptr,
MSVCRT_wchar_t cur = tolowerW(*nptr);
int v;
if(isdigitW(cur)) {
if(cur>='0' && cur<='9') {
if(cur >= '0'+base)
break;
v = cur-'0';
......@@ -2139,7 +2139,7 @@ unsigned __int64 CDECL MSVCRT__wcstoui64_l(const MSVCRT_wchar_t *nptr,
MSVCRT_wchar_t cur = tolowerW(*nptr);
int v;
if(isdigitW(cur)) {
if(cur>='0' && cur<='9') {
if(cur >= '0'+base)
break;
v = *nptr-'0';
......
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