summaryrefslogtreecommitdiff
path: root/hex.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2007-03-27 06:14:39 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2007-03-27 06:14:39 +0000
commit13c3eb1ca0fd303a9dc88d70a6f80b356c421818 (patch)
treedfb33a2332f27c02176ca9b66769aa825f96ddbd /hex.c
parentf80e73829dc3a71f2fda25636fbb0a360214c8a7 (diff)
downloadgpsd-13c3eb1ca0fd303a9dc88d70a6f80b356c421818.tar.gz
too much thinking about regexes i think. hex use a-f, not a-z.
Diffstat (limited to 'hex.c')
-rw-r--r--hex.c8
1 files changed, 4 insertions, 4 deletions
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';