| 266 | } |
| 267 | |
| 268 | int decode_hex(uint8_t *buf, const char *str, int len) |
| 269 | { |
| 270 | int h0, h1, i; |
| 271 | |
| 272 | for(i = 0; i < len; i++) { |
| 273 | h0 = from_hex(str[2 * i]); |
| 274 | if (h0 < 0) |
| 275 | return -1; |
| 276 | h1 = from_hex(str[2 * i + 1]); |
| 277 | if (h1 < 0) |
| 278 | return -1; |
| 279 | buf[i] = (h0 << 4) | h1; |
| 280 | } |
| 281 | return 0; |
| 282 | } |
| 283 | |
| 284 | /* return NULL if no end of header found */ |
| 285 | const char *skip_header(const char *p) |
no test coverage detected