Commit a35adb19 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Treat only ASCII digits as digits.

parent f34cecba
......@@ -214,7 +214,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
if(*ctx->ptr == '0' && !('0' <= ctx->ptr[1] && ctx->ptr[1] <= '9') && ctx->ptr[1] != '.')
return *ctx->ptr++;
while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) {
while(ctx->ptr < ctx->end && is_digit(*ctx->ptr)) {
hlp = d*10 + *(ctx->ptr++) - '0';
if(d>MAXLONGLONG/10 || hlp<0) {
exp++;
......@@ -223,7 +223,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
else
d = hlp;
}
while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) {
while(ctx->ptr < ctx->end && is_digit(*ctx->ptr)) {
exp++;
ctx->ptr++;
}
......@@ -232,7 +232,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
use_int = FALSE;
ctx->ptr++;
while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr)) {
while(ctx->ptr < ctx->end && is_digit(*ctx->ptr)) {
hlp = d*10 + *(ctx->ptr++) - '0';
if(d>MAXLONGLONG/10 || hlp<0)
break;
......@@ -240,7 +240,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
d = hlp;
exp--;
}
while(ctx->ptr < ctx->end && iswdigit(*ctx->ptr))
while(ctx->ptr < ctx->end && is_digit(*ctx->ptr))
ctx->ptr++;
}
......@@ -255,7 +255,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
ctx->ptr++;
}
if(!iswdigit(*ctx->ptr)) {
if(!is_digit(*ctx->ptr)) {
FIXME("Invalid numeric literal\n");
return 0;
}
......@@ -266,7 +266,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
e = e*10 + *(ctx->ptr++) - '0';
if(sign == -1 && -e+exp < -(INT_MAX/100)) {
/* The literal will be rounded to 0 anyway. */
while(iswdigit(*ctx->ptr))
while(is_digit(*ctx->ptr))
ctx->ptr++;
*(double*)ret = 0;
return tDouble;
......@@ -276,7 +276,7 @@ static int parse_numeric_literal(parser_ctx_t *ctx, void **ret)
FIXME("Invalid numeric literal\n");
return 0;
}
} while(iswdigit(*ctx->ptr));
} while(is_digit(*ctx->ptr));
exp += sign*e;
}
......
......@@ -1560,14 +1560,14 @@ static HRESULT WINAPI RegExp2_Replace(IRegExp2 *iface, BSTR source, VARIANT repl
default: {
DWORD idx;
if(!iswdigit(ptr[1])) {
if(!is_digit(ptr[1])) {
hres = strbuf_append(&buf, ptr, 1);
prev_ptr = ptr + 1;
break;
}
idx = ptr[1] - '0';
if(iswdigit(ptr[2]) && idx * 10 + (ptr[2] - '0') <= state->paren_count) {
if(is_digit(ptr[2]) && idx * 10 + (ptr[2] - '0') <= state->paren_count) {
idx = idx * 10 + (ptr[2] - '0');
prev_ptr = ptr + 3;
}else if(idx && idx <= state->paren_count) {
......
......@@ -373,6 +373,11 @@ static inline BOOL is_int32(double d)
return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d;
}
static inline BOOL is_digit(WCHAR c)
{
return '0' <= c && c <= '9';
}
HRESULT create_regexp(IDispatch**) DECLSPEC_HIDDEN;
BSTR string_replace(BSTR,BSTR,BSTR,int,int) DECLSPEC_HIDDEN;
......
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