Building libdatrie-0.2.10 on OS X 10.11, I get a warning:
gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I/sw/include -g -O2 -MT trietool.o -MD -MP -MF .deps/trietool.Tpo -c -o trietool.o trietool.c
trietool.c:128:13: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (res < 0)
~~~ ^ ~
1 warning generated.
res is (correctly per iconv prototype) a size_t, but size_t is generally some sort of unsigned int: the warning seems on target. The iconv manpage says that the return in case of error isn't "-1" but is "(size_t)(-1)": -1 cast to the return type. And its example code is:
size_t nconv;
nconv = iconv (cd, &inptr, &insize, &wrptr, &avail);
if (nconv == (size_t) -1) ...
So trietool.c at line 128 should be changed:
- if (res < 0)
+ if (res == (size_t) -1)
return res;
Building libdatrie-0.2.10 on OS X 10.11, I get a warning:
res is (correctly per iconv prototype) a size_t, but size_t is generally some sort of unsigned int: the warning seems on target. The iconv manpage says that the return in case of error isn't "-1" but is "(size_t)(-1)": -1 cast to the return type. And its example code is:
So trietool.c at line 128 should be changed: