Simon Josefsson wrote:
> bool
> isbase64 (char ch)
> {
> return to_uchar (ch) <= 255 && 0 <= b64[to_uchar (ch)];
> }
> ...
> 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?
bool
isbase64 (char ch)
{
return
#if UCHAR_MAX > 255
to_uchar (ch) <= 255
#else
true
#endif
&& 0 <= b64[to_uchar (ch)];
}
or
bool
isbase64 (char ch)
{
#if UCHAR_MAX > 255
if (to_uchar (ch) > 255)
return false;
#endif
return 0 <= b64[to_uchar (ch)];
}
Ugly, but a warning on which people stumble over and over again (because
it appears even without -Wall) is even worse. I work around this kind of
warning also in GNU gettext.
Bruno
_______________________________________________
bug-gnulib mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnulib