Returns int value of hex string character |c| */
| 346 | |
| 347 | /* Returns int value of hex string character |c| */ |
| 348 | static uint8_t hex_to_uint(uint8_t c) { |
| 349 | if ('0' <= c && c <= '9') { |
| 350 | return (uint8_t)(c - '0'); |
| 351 | } |
| 352 | if ('A' <= c && c <= 'F') { |
| 353 | return (uint8_t)(c - 'A' + 10); |
| 354 | } |
| 355 | if ('a' <= c && c <= 'f') { |
| 356 | return (uint8_t)(c - 'a' + 10); |
| 357 | } |
| 358 | return 0; |
| 359 | } |
| 360 | |
| 361 | /* Decodes percent-encoded byte string |value| with length |valuelen| |
| 362 | and returns the decoded byte string in allocated buffer. The return |