From: Alex Henrie alexhenrie24@gmail.com
--- dlls/mfplat/main.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index ebab4ed6f1f..05974a6666b 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -646,15 +646,6 @@ static WCHAR* guid_to_string(WCHAR *str, REFGUID guid) return str; }
-static inline BOOL is_valid_hex(WCHAR c) -{ - if (!(((c >= '0') && (c <= '9')) || - ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F')))) - return FALSE; - return TRUE; -} - static BOOL GUIDFromString(LPCWSTR s, GUID *id) { int i; @@ -664,7 +655,7 @@ static BOOL GUIDFromString(LPCWSTR s, GUID *id) id->Data1 = 0; for (i = 0; i < 8; i++) { - if (!is_valid_hex(s[i])) return FALSE; + if (!iswxdigit(s[i])) return FALSE; id->Data1 = (id->Data1 << 4) | guid_conv_table[s[i]]; } if (s[8]!='-') return FALSE; @@ -672,7 +663,7 @@ static BOOL GUIDFromString(LPCWSTR s, GUID *id) id->Data2 = 0; for (i = 9; i < 13; i++) { - if (!is_valid_hex(s[i])) return FALSE; + if (!iswxdigit(s[i])) return FALSE; id->Data2 = (id->Data2 << 4) | guid_conv_table[s[i]]; } if (s[13]!='-') return FALSE; @@ -680,7 +671,7 @@ static BOOL GUIDFromString(LPCWSTR s, GUID *id) id->Data3 = 0; for (i = 14; i < 18; i++) { - if (!is_valid_hex(s[i])) return FALSE; + if (!iswxdigit(s[i])) return FALSE; id->Data3 = (id->Data3 << 4) | guid_conv_table[s[i]]; } if (s[18]!='-') return FALSE; @@ -692,7 +683,7 @@ static BOOL GUIDFromString(LPCWSTR s, GUID *id) if (s[i]!='-') return FALSE; i++; } - if (!is_valid_hex(s[i]) || !is_valid_hex(s[i+1])) return FALSE; + if (!iswxdigit(s[i]) || !iswxdigit(s[i+1])) return FALSE; id->Data4[(i-19)/2] = guid_conv_table[s[i]] << 4 | guid_conv_table[s[i+1]]; }
This is not an equivalent change. We don't need fullwidth forms to pass this hex check. Unless this happens on windows, which seems very unlikely.
On Wed Nov 23 06:43:09 2022 +0000, Nikolay Sivov wrote:
This is not an equivalent change. We don't need fullwidth forms to pass this hex check. Unless this happens on windows, which seems very unlikely.
My mistake. It looks like the equivalent function is `isxdigit`, without the "w". Despite the lack of a "w" it does operate on Unicode characters.