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

Marcus Meissner marcus at jet.franken.de
Sun Nov 16 03:21:02 CST 2008


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



More information about the wine-devel mailing list