convert hexadecimal string to unsigned integer
| 23 | |
| 24 | // convert hexadecimal string to unsigned integer |
| 25 | static const char *hatoui(const char *first, const char *last, |
| 26 | unsigned int& out) |
| 27 | { |
| 28 | unsigned int result = 0; |
| 29 | for (; first != last; ++first) |
| 30 | { |
| 31 | int digit; |
| 32 | if (json_isdigit(*first)) |
| 33 | digit = *first - '0'; |
| 34 | |
| 35 | else if (*first >= 'a' && *first <= 'f') |
| 36 | digit = *first - 'a' + 10; |
| 37 | |
| 38 | else if (*first >= 'A' && *first <= 'F') |
| 39 | digit = *first - 'A' + 10; |
| 40 | |
| 41 | else |
| 42 | break; |
| 43 | |
| 44 | result = 16 * result + digit; |
| 45 | } |
| 46 | out = result; |
| 47 | |
| 48 | return first; |
| 49 | } |
| 50 | |
| 51 | enum jtokentype getJsonToken(std::string& tokenVal, unsigned int& consumed, |
| 52 | const char *raw, const char *end) |
no test coverage detected