Jacek Caban : mshtml: Fix checks for digit characters.
Alexandre Julliard
julliard at winehq.org
Tue Nov 12 16:56:07 CST 2019
Module: wine
Branch: master
Commit: 4873dd49aaa48cdb033a87908e1690f717e5d4da
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4873dd49aaa48cdb033a87908e1690f717e5d4da
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Nov 12 20:49:03 2019 +0100
mshtml: Fix checks for digit characters.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/editor.c | 2 +-
dlls/mshtml/htmlbody.c | 2 +-
dlls/mshtml/htmlelem.c | 4 ++--
dlls/mshtml/htmlelemcol.c | 2 +-
dlls/mshtml/htmlnode.c | 2 +-
dlls/mshtml/htmlselect.c | 2 +-
dlls/mshtml/htmlstyle.c | 10 +++++-----
dlls/mshtml/htmltable.c | 4 ++--
dlls/mshtml/mshtml_private.h | 5 +++++
dlls/mshtml/mutation.c | 8 ++++----
10 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 75a69976fe..0a1b4879bd 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -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;
diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c
index 1d032d62d3..981d93f9b4 100644
--- a/dlls/mshtml/htmlbody.c
+++ b/dlls/mshtml/htmlbody.c
@@ -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;
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 49126935b3..a594337ead 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -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;
diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c
index 62c7254c77..51cc90110f 100644
--- a/dlls/mshtml/htmlelemcol.c
+++ b/dlls/mshtml/htmlelemcol.c
@@ -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) {
diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c
index faffb6bd02..d80c615e72 100644
--- a/dlls/mshtml/htmlnode.c
+++ b/dlls/mshtml/htmlnode.c
@@ -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;
diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c
index 21d4fc7acb..739da9bf0f 100644
--- a/dlls/mshtml/htmlselect.c
+++ b/dlls/mshtml/htmlselect.c
@@ -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");
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c
index 39fd489bda..15e2f26303 100644
--- a/dlls/mshtml/htmlstyle.c
+++ b/dlls/mshtml/htmlstyle.c
@@ -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;
}
diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c
index 972a2175bb..a37ab35413 100644
--- a/dlls/mshtml/htmltable.c
+++ b/dlls/mshtml/htmltable.c
@@ -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;
}
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 441da2019c..9612b32608 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c
index 6903fe8652..96490f9abd 100644
--- a/dlls/mshtml/mutation.c
+++ b/dlls/mshtml/mutation.c
@@ -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');
}
More information about the wine-cvs
mailing list