[syslinux] [PATCH] hdt & gcc -Werror

Gene Cumm gene.cumm at gmail.com
Sat Jun 19 04:40:08 PDT 2010


On Fri, Jun 18, 2010 at 21:14, Jeffrey Hutzelman <jhutz at cmu.edu> wrote:
> --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);

Good point: more_printf("Flags     : %s\n", buffer); would cut both lines.

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

and again.

>> -           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);
>

This might be the only one that might be worthwhile in separating but
I haven't played with the more_printf macro or looked very closely at
what the output resembles at that point other than to see that
more_printf acts "like" printf piped through more.

>
>
> ... and so on.
>
> -- Jeff
>

Erwan/Pierre?

-- 
-Gene




More information about the Syslinux mailing list