Hi!
compiling odhcp6c fails on OpenWrt:
/home/public/source/openwrt/build_dir/target-arm_v5te_uClibc-0.9.33.2_eabi/odhcp6c-2012-11-29/src/script.c:
In function 'script_unhexlify':
/home/public/source/openwrt/build_dir/target-arm_v5te_uClibc-0.9.33.2_eabi/odhcp6c-2012-11-29/src/script.c:61:3:
error: comparison is always false due to limited range of data type
[-Werror=type-limits]
/home/public/source/openwrt/build_dir/target-arm_v5te_uClibc-0.9.33.2_eabi/odhcp6c-2012-11-29/src/script.c:61:3:
error: comparison is always false due to limited range of data type
[-Werror=type-limits]
cc1: all warnings being treated as errors
Looking at that part of script.c:
ssize_t script_unhexlify(uint8_t *dst, size_t len, const char *src)
{
size_t c;
for (c = 0; c < len && src[0] && src[1]; ++c) {
int8_t x = (int8_t)*src++;
int8_t y = (int8_t)*src++;
if (x < 0 || (x = hexvals[x]) < 0
|| y < 0 || (y = hexvals[y]) < 0)
return -1;
dst[c] = x << 4 | y;
while (*src < 0 || (*src && hexvals[(uint8_t)*src] < 0))
src++;
}
return c;
}
So yes, the condition in the while-loop will always be false, as *src is of type
char* which is identical to uint8_t, at least on my target platform (arm_v5te).
I'm too lazy to get all the way into what is actually supposed to happen there,
but as far as I remember, you should use signed char or int8_t if you intend to
use signed 8-bit integers.
Cheers
Daniel
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel