From 291ec6bf1cd3cf1295871691674d9c00d16e591d Mon Sep 17 00:00:00 2001 From: Peter Marschall Date: Thu, 2 Jun 2011 16:15:30 +0200 Subject: [PATCH] opensc-explorer: remove hex2binary() With the last users gone, there's no need to keep hex2binary(). Signed-off-by: Peter Marschall --- src/tools/opensc-explorer.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/tools/opensc-explorer.c b/src/tools/opensc-explorer.c index cb298655..a8a1f014 100644 --- a/src/tools/opensc-explorer.c +++ b/src/tools/opensc-explorer.c @@ -71,7 +71,6 @@ static const char *option_help[] = { "Verbose operation. Use several times to enable debug output.", }; -static size_t hex2binary(u8 *out, size_t outlen, const char *in); /* declare functions called by user commands */ static int do_ls(int argc, char **argv); @@ -1092,41 +1091,6 @@ err: return -err; } -static size_t hex2binary(u8 *out, size_t outlen, const char *in) -{ - size_t inlen = strlen(in), len = outlen; - const char *p = in; - int s = 0; - - out--; - while (inlen && (len || s)) { - char c = *p++; - inlen--; - if (!isxdigit(c)) - continue; - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'a' && c <= 'f') - c -= 'a' - 10; - else /* (c >= 'A' && c <= 'F') */ - c -= 'A' - 10; - if (s) - *out <<= 4; - else { - len--; - *(++out) = 0; - } - s = !s; - *out |= (u8)c; - } - if (s) { - printf("Error: the number of hex digits must be even.\n"); - return 0; - } - - return outlen - len; -} - static int do_update_binary(int argc, char **argv) { u8 buf[240];