double output length assumed ; does NOT zero-terminate */
| 459 | |
| 460 | /* double output length assumed ; does NOT zero-terminate */ |
| 461 | inline static int string2hex( |
| 462 | /* input */ const char *str, int len, |
| 463 | /* output */ char *hex ) |
| 464 | { |
| 465 | int orig_len; |
| 466 | |
| 467 | if (len==0) { |
| 468 | *hex='0'; |
| 469 | return 1; |
| 470 | } |
| 471 | |
| 472 | orig_len=len; |
| 473 | while ( len ) { |
| 474 | |
| 475 | *hex=fourbits2char[((*str) >> 4) & 0x0f]; |
| 476 | hex++; |
| 477 | *hex=fourbits2char[(*str) & 0x0f]; |
| 478 | hex++; |
| 479 | len--; |
| 480 | str++; |
| 481 | |
| 482 | } |
| 483 | return orig_len * 2; |
| 484 | } |
| 485 | |
| 486 | inline static int hex2string( |
| 487 | /* input */ const char *str, int len, |
no outgoing calls
no test coverage detected