[PATCH libFS] Silence gcc warning.

Mark Kettenis mark.kettenis at xs4all.nl
Sat Feb 19 07:49:29 PST 2011


> Date: Sat, 19 Feb 2011 15:04:24 +0100
> From: Julien Cristau <jcristau at debian.org>
> 
> > diff --git a/test/FSGetErrorText.c b/test/FSGetErrorText.c
> > index 31523c6..f9a88d2 100644
> > --- a/test/FSGetErrorText.c
> > +++ b/test/FSGetErrorText.c
> > @@ -40,7 +40,7 @@ CheckErrorMessage(FSServer *srv, int code, const char *codestr)
> >  
> >      if (!FSGetErrorText(srv, code, buf, sizeof(buf))) {
> >  	fprintf(stderr, "FSGetErrorText(srv, %s (%d), buf, %d) failed",
> > -		codestr, code, sizeof(buf));
> > +		codestr, code, (int) sizeof(buf));
> >  	return 0;
> >      }
> >  
> Or you could use %zu in the format string and avoid the cast?

That's certainly more elegant, but the 'z' modifier is a C99 feature
and I'm not completely sure all supported platforms support it.  In
particular the Solaris 9 printf(3C) man page seems to suggest it
doesn't.  OpenBSD does support it, so in that sense I don't have any
objection.


More information about the xorg-devel mailing list