-- v2: comsvcs: Use the isxdigit function instead of reimplementing it.
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/comsvcs/main.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/dlls/comsvcs/main.c b/dlls/comsvcs/main.c index 43803f60632..f6f5a2d624d 100644 --- a/dlls/comsvcs/main.c +++ b/dlls/comsvcs/main.c @@ -781,12 +781,6 @@ static const BYTE guid_conv_table[256] = 0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* 0x60 */ };
-static BOOL is_valid_hex(WCHAR c) -{ - return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F'); -} - static HRESULT guid_from_string(const WCHAR *s, GUID *ret) { BOOL has_brackets; @@ -803,7 +797,7 @@ static HRESULT guid_from_string(const WCHAR *s, GUID *ret)
for (i = 0; i < 8; i++) { - if (!is_valid_hex(s[i])) return FALSE; + if (!isxdigit(s[i])) return FALSE; guid.Data1 = (guid.Data1 << 4) | guid_conv_table[s[i]]; } s += 8; @@ -813,7 +807,7 @@ static HRESULT guid_from_string(const WCHAR *s, GUID *ret)
for (i = 0; i < 4; i++) { - if (!is_valid_hex(s[0])) return FALSE; + if (!isxdigit(s[0])) return FALSE; guid.Data2 = (guid.Data2 << 4) | guid_conv_table[s[i]]; } s += 4; @@ -823,7 +817,7 @@ static HRESULT guid_from_string(const WCHAR *s, GUID *ret)
for (i = 0; i < 4; i++) { - if (!is_valid_hex(s[i])) return FALSE; + if (!isxdigit(s[i])) return FALSE; guid.Data3 = (guid.Data3 << 4) | guid_conv_table[s[i]]; } s += 4; @@ -838,7 +832,7 @@ static HRESULT guid_from_string(const WCHAR *s, GUID *ret) if (s[i] != '-') return FALSE; i++; } - if (!is_valid_hex(s[i]) || !is_valid_hex(s[i+1])) return FALSE; + if (!isxdigit(s[i]) || !isxdigit(s[i+1])) return FALSE; guid.Data4[i / 2] = guid_conv_table[s[i]] << 4 | guid_conv_table[s[i+1]]; } s += 17;
This merge request was closed by Alexandre Julliard.
It would need to be iswxdigit(), but that's not safe either since it can return true for more than just ASCII chars.