[syslinux] [PATCH] hdt & gcc -Werror

Jeffrey Hutzelman jhutz at cmu.edu
Fri Jun 18 18:14:07 PDT 2010


--On Friday, June 18, 2010 06:43:48 PM -0400 Gene Cumm 
<gene.cumm at gmail.com> wrote:

> From: Gene Cumm <gene.cumm at gmail.com>
>
> Fix several calls to more_printf() as eventually printf() is called
> without a literal string which generate warnings with gcc and lead to
> errors when -Werror is active.
>
> Signed-off-by: Gene Cumm <gene.cumm at gmail.com>
>
> The message "format not a string literal and no format arguments" at
> first seems strange but by doing this change it forces printf to print
> exactly what is in the string variable without attempting to
> re-interpret for another argument (just in case there's a '%' in the
> string).

This is a good patch, but why not go a bit further...


>  	snprintf(output_buffer, sizeof output_buffer, "Flags     : %s\n",
>  		 buffer);
> -	more_printf(output_buffer);
> +	more_printf("%s", output_buffer);

more_printf(Flags     : %s\n", buffer);



>      if (found == true) {
>  	strncat(buffer, "\n", 1);
> -	more_printf(buffer);
> +	more_printf("%s", buffer);
>      }

more_printf("%s\n", buffer)


> -	    more_printf(first_line);
> -	    more_printf(second_line);
> +	    more_printf("%s", first_line);
> +	    more_printf("%s", second_line);
>  	    more_printf("\n");

Good grief!

more_printf("%s%s\n", first_line, second_line);



... and so on.

-- Jeff




More information about the Syslinux mailing list