On Mon, Nov 18, 2013 at 7:16 PM, Eitan Adler <[email protected]> wrote:
> clang gives a warning when building fmt(1):
>
> fmt.c:400:35: warning: passing 'char *' to parameter of type 'const
> unsigned char *' converts between pointers to integer types with
> different sign
>
> might_be_header takes a pointer to unsigned char.  However there is no
> reason for this to be the case.  The patch bellow fixes that. In
> addition it adds 'const' to the type of 'line'.
...
> @@ -486,7 +486,7 @@
>   * conservative to avoid mangling ordinary civilised text.
>   */
>  static int
> -might_be_header(const unsigned char *line)
> +might_be_header(const char *line)
>  {
>
>   if (!isupper(*line++))

The argument passed to isupper must be "The argument to isupper() must
be EOF or representable as an unsigned char; otherwise, the result is
undefined."  That's guaranteed by the current version, but the diff
breaks that, so no, this isn't right, unless I missed a check
somewhere that tosses all negative chars...


Philip Guenther

Reply via email to