tools/fnt2bdf: fix a few compiler warnings (1/10)

Austin English austinenglish at gmail.com
Sun Nov 16 14:53:46 CST 2008


On Sun, Nov 16, 2008 at 3:21 AM, Marcus Meissner <marcus at jet.franken.de> wrote:
> On Wed, Nov 12, 2008 at 10:28:37AM +0100, Michael Stefaniuc wrote:
>> Austin English wrote:
>> > This series of patches fixes most of the new warnings generated in gcc
>> > 4.3.2. There's one issue left, but I'm not quite sure what should be
>> > done on that one.
>> > diff --git a/tools/fnt2bdf.c b/tools/fnt2bdf.c
>> > index 1a14d6c..3c3134b 100644
>> > --- a/tools/fnt2bdf.c
>> > +++ b/tools/fnt2bdf.c
>> > @@ -595,14 +595,14 @@ int main(int argc, char **argv)
>> >
>> >                 if( !(lpfont = (unsigned char*) realloc( lpfont, length )) )
>> >                 {
>> >-                    fprintf(stderr, errorMemory );
>> >+                    fprintf(stderr, "%s", errorMemory );
>> Ugly. You could just use fputs instead.
>>
>> But if you know that the passed in strings are safe aka no format
>> specifiers in them you can leave the code as is as the compiler warning
>> is bogus.
>
> Well, gcc will optimize fprintf(X,"%s",Y) to fputs(X,Y) (and some other funny
> stuff when errorMemory is known and constant).
>
> But I disagree with leaving it in as-is ...
> It is sloppy coding and might lead to later problems when used cut&pasted.
>
> Ciao, Marcus
>

If you've got a better patch, please submit. I opened a bug and put
these patches there, as they aren't correct. I was only trying to get
Wine compiling without errors again, a proper fix would be
appreciated.

-- 
-Austin



More information about the wine-devel mailing list