<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] warning cleared



On 2005-09-20 00:40:24 -0500, David Champion wrote:
> Another insignificant patch -- this one clears a compiler warning.

I disagree with this patch. A warning may indicate an error, and
the goal is not to clear the warning, but to fix the error.

[...]
>         n = atoi(++p);                        /* find pmatch index */
> -       while (isdigit(*p))
> +       while (isdigit((int)*p))
>           ++p;                                /* skip subst token */
[...]

*p is a char, whereas isdigit takes an int whose value corresponds
to an unsigned char or EOF. You need to cast to an unsigned char
first (you can then cast to an int, but this is useless, and the
compiler shouldn't complain):

  isdigit((unsigned char) *p)

BTW, the SKIPWS(x) from rfc822.c could wrong too (in practice,
one can have non-ASCII characters in headers, even though this
is incorrect).

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA