From 13c3eb1ca0fd303a9dc88d70a6f80b356c421818 Mon Sep 17 00:00:00 2001 From: Chris Kuethe Date: Tue, 27 Mar 2007 06:14:39 +0000 Subject: too much thinking about regexes i think. hex use a-f, not a-z. --- hex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'hex.c') diff --git a/hex.c b/hex.c index c193fa23..c29d63b7 100644 --- a/hex.c +++ b/hex.c @@ -54,18 +54,18 @@ int hex2bin(char *s) a = s[0] & 0xff; b = s[1] & 0xff; - if ((a >= 'a') && (a <= 'z')) + if ((a >= 'a') && (a <= 'f')) a = a + 10 - 'a'; - else if ((a >= 'A') && (a <= 'Z')) + else if ((a >= 'A') && (a <= 'F')) a = a + 10 - 'A'; else if ((a >= '0') && (a <= '9')) a -= '0'; else return -1; - if ((b >= 'a') && (b <= 'z')) + if ((b >= 'a') && (b <= 'f')) b = b + 10 - 'a'; - else if ((b >= 'A') && (b <= 'Z')) + else if ((b >= 'A') && (b <= 'F')) b = b + 10 - 'A'; else if ((b >= '0') && (b <= '9')) b -= '0'; -- cgit v1.2.1