[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warning in 'base64' module
From: |
Simon Josefsson |
Subject: |
Re: warning in 'base64' module |
Date: |
Wed, 11 Jan 2006 18:21:33 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> The base64 module has a warning on Linux/glibc:
>
> gcc -DHAVE_CONFIG_H -I. -I/packages/megatestdir/base64/lib -I.. -g -O2 -c
> /packages/megatestdir/base64/lib/base64.c
> /packages/megatestdir/base64/lib/base64.c: In function `isbase64':
> /packages/megatestdir/base64/lib/base64.c:284: warning: comparison is always
> true due to limited range of data type
Caused by:
static const signed char b64[0x100] = {
...
bool
isbase64 (char ch)
{
return to_uchar (ch) <= 255 && 0 <= b64[to_uchar (ch)];
}
mentioned in:
http://article.gmane.org/gmane.comp.lib.gnulib.bugs/2694/match=base64+comparison+true+limited+range+data+type
Presumably the warning is because gcc believe an unsigned char cannot
be larger than 255, but we didn't want to assume that since I don't
think C89 guarantee it. Correct me if I'm wrong...
Is there a clean fix?