| 204 | // Parses text to unsigned integer value. Returns true if failed to convert the value. |
| 205 | template<typename T> |
| 206 | static bool ParseHex(const T* str, int32 length, uint32* result) |
| 207 | { |
| 208 | uint32 sum = 0; |
| 209 | const T* p = str; |
| 210 | const T* end = str + length; |
| 211 | if (*p == '0' && *(p + 1) == 'x') |
| 212 | p += 2; |
| 213 | while (*p && p < end) |
| 214 | { |
| 215 | int32 c = *p - '0'; |
| 216 | if (c < 0 || c > 9) |
| 217 | { |
| 218 | c = ToLower(*p) - 'a' + 10; |
| 219 | if (c < 10 || c > 15) |
| 220 | return true; |
| 221 | } |
| 222 | sum = 16 * sum + c; |
| 223 | p++; |
| 224 | } |
| 225 | *result = sum; |
| 226 | return false; |
| 227 | } |
| 228 | |
| 229 | // Parses text to unsigned integer value. Returns true if failed to convert the value. |
| 230 | template<typename T> |
no test coverage detected