MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / decode_hex

Function decode_hex

tinyemu/fs_utils.c:268–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268int 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 */
285const char *skip_header(const char *p)

Callers 1

parse_hex_bufFunction · 0.85

Calls 1

from_hexFunction · 0.85

Tested by

no test coverage detected