]> git.decadent.org.uk Git - odhcp6c.git/blobdiff - src/script.c
Fix compilation on platforms with unsgined char
[odhcp6c.git] / src / script.c
index ff81278bf59b6f3e1dd1082634f5086aed1da505..2117aebe1cd4201cdfdf632eb881d143715d07b6 100644 (file)
@@ -24,7 +24,7 @@
 #include "odhcp6c.h"
 
 static const char hexdigits[] = "0123456789abcdef";
-static const char hexvals[] = {
+static const int8_t hexvals[] = {
     -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -1, -1, -2, -1, -1,
     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
     -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -58,7 +58,8 @@ ssize_t script_unhexlify(uint8_t *dst, size_t len, const char *src)
                                || y < 0 || (y = hexvals[y]) < 0)
                        return -1;
                dst[c] = x << 4 | y;
-               while (*src < 0 || (*src && hexvals[(uint8_t)*src] < 0))
+               while (((int8_t)*src) < 0 ||
+                               (*src && hexvals[(uint8_t)*src] < 0))
                        src++;
        }