mshtml: Fix checks for digit characters.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Jacek Caban 2019-11-12 20:49:03 +01:00 committed by Alexandre Julliard
parent b680571a50
commit 4873dd49aa
10 changed files with 23 additions and 18 deletions

View File

@ -822,7 +822,7 @@ static HRESULT exec_composesettings(HTMLDocumentNode *doc, DWORD cmdexecopt, VAR
if(!ptr)
return S_OK;
if(iswdigit(*++ptr)) {
if(is_digit(*++ptr)) {
VARIANT v;
V_VT(&v) = VT_I4;

View File

@ -95,7 +95,7 @@ static int comp_value(const WCHAR *ptr, int dpc)
while(dpc--) {
if(!*ptr)
ret *= 16;
else if(iswdigit(ch = *ptr++))
else if(is_digit(ch = *ptr++))
ret = ret*16 + (ch-'0');
else if('a' <= ch && ch <= 'f')
ret = ret*16 + (ch-'a') + 10;

View File

@ -700,7 +700,7 @@ static HRESULT HTMLRectCollection_get_dispid(DispatchEx *dispex, BSTR name, DWOR
DWORD idx = 0;
WCHAR *ptr;
for(ptr = name; *ptr && iswdigit(*ptr); ptr++)
for(ptr = name; *ptr && is_digit(*ptr); ptr++)
idx = idx*10 + (*ptr-'0');
if(*ptr)
return DISP_E_UNKNOWNNAME;
@ -6061,7 +6061,7 @@ static HRESULT HTMLFiltersCollection_get_dispid(DispatchEx *dispex, BSTR name, D
WCHAR *ptr;
int idx = 0;
for(ptr = name; *ptr && iswdigit(*ptr); ptr++)
for(ptr = name; *ptr && is_digit(*ptr); ptr++)
idx = idx*10 + (*ptr-'0');
if(*ptr)
return DISP_E_UNKNOWNNAME;

View File

@ -562,7 +562,7 @@ static HRESULT HTMLElementCollection_get_dispid(DispatchEx *dispex, BSTR name, D
if(!*name)
return DISP_E_UNKNOWNNAME;
for(ptr = name; *ptr && iswdigit(*ptr); ptr++)
for(ptr = name; *ptr && is_digit(*ptr); ptr++)
idx = idx*10 + (*ptr-'0');
if(*ptr) {

View File

@ -373,7 +373,7 @@ static HRESULT HTMLDOMChildrenCollection_get_dispid(DispatchEx *dispex, BSTR nam
DWORD idx=0;
UINT32 len = 0;
for(ptr = name; *ptr && iswdigit(*ptr); ptr++)
for(ptr = name; *ptr && is_digit(*ptr); ptr++)
idx = idx*10 + (*ptr-'0');
if(*ptr)
return DISP_E_UNKNOWNNAME;

View File

@ -1190,7 +1190,7 @@ static HRESULT HTMLSelectElement_get_dispid(HTMLDOMNode *iface, BSTR name, DWORD
const WCHAR *ptr;
DWORD idx = 0;
for(ptr = name; *ptr && iswdigit(*ptr); ptr++) {
for(ptr = name; *ptr && is_digit(*ptr); ptr++) {
idx = idx*10 + (*ptr-'0');
if(idx > MSHTML_CUSTOM_DISPID_CNT) {
WARN("too big idx\n");

View File

@ -871,7 +871,7 @@ static void fix_px_value(nsAString *nsstr)
if(!*ptr)
break;
while(*ptr && iswdigit(*ptr))
while(*ptr && is_digit(*ptr))
ptr++;
if(!*ptr || iswspace(*ptr)) {
@ -1096,7 +1096,7 @@ static HRESULT get_nsstyle_property_var(nsIDOMCSSStyleDeclaration *nsstyle, styl
ptr++;
}
while(iswdigit(*ptr))
while(is_digit(*ptr))
i = i*10 + (*ptr++ - '0');
if(!*ptr) {
@ -1228,7 +1228,7 @@ static HRESULT get_nsstyle_pixel_val(HTMLStyle *This, styleid_t sid, LONG *p)
if(*ptr == '.') {
/* Skip all digits. We have tests showing that we should not round the value. */
while(iswdigit(*++ptr));
while(is_digit(*++ptr));
}
}
@ -2953,11 +2953,11 @@ static void update_filter(HTMLStyle *This)
ptr2 += ARRAY_SIZE(opacityW);
while(iswdigit(*ptr2))
while(is_digit(*ptr2))
fval = fval*10.0f + (float)(*ptr2++ - '0');
if(*ptr2 == '.') {
while(iswdigit(*++ptr2)) {
while(is_digit(*++ptr2)) {
fval += e * (float)(*ptr2++ - '0');
e *= 0.1f;
}

View File

@ -1021,9 +1021,9 @@ static HRESULT nsstr_to_truncated_bstr(const nsAString *nsstr, BSTR *ret_ptr)
nsAString_GetData(nsstr, &str);
for(ptr = str; iswdigit(*ptr); ptr++);
for(ptr = str; is_digit(*ptr); ptr++);
if(*ptr == '.') {
for(end = ptr++; iswdigit(*ptr); ptr++);
for(end = ptr++; is_digit(*ptr); ptr++);
if(*ptr)
end = NULL;
}

View File

@ -1363,6 +1363,11 @@ static inline VARIANT_BOOL variant_bool(BOOL b)
return b ? VARIANT_TRUE : VARIANT_FALSE;
}
static inline BOOL is_digit(WCHAR c)
{
return '0' <= c && c <= '9';
}
#ifdef __i386__
extern void *call_thiscall_func;
#endif

View File

@ -109,16 +109,16 @@ static PRUnichar *handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *
while(iswspace(*ptr))
ptr++;
if(!iswdigit(*ptr))
if(!is_digit(*ptr))
return NULL;
while(iswdigit(*ptr))
while(is_digit(*ptr))
majorv = majorv*10 + (*ptr++ - '0');
if(*ptr == '.') {
ptr++;
if(!iswdigit(*ptr))
if(!is_digit(*ptr))
return NULL;
while(iswdigit(*ptr))
while(is_digit(*ptr))
minorv = minorv*10 + (*ptr++ - '0');
}