[PATCH 1/4] dix: warning fix

Julien Cristau jcristau at debian.org
Tue Mar 15 09:00:19 PDT 2011


On Tue, Mar 15, 2011 at 08:35:12 -0700, Keith Packard wrote:

> On Tue, 15 Mar 2011 11:05:04 -0400, Adam Jackson <ajax at redhat.com> wrote:
> 
> > -	ErrorF("[dix] AddResource(%lx, %lx, %lx), client=%d \n",
> > -		(unsigned long)id, type, (unsigned long)value, client);
> > +	ErrorF("[dix] AddResource(%x, %x, %lx), client=%d \n",
> > +	       id, type, (unsigned long)value, client);
> 
> <bikeshed>
> I hate printf. This does assume that XID is the same as 'unsigned int'
> on all machines. I think XID is still 'unsigned long' on 32-bit
> machines, right? We could use %lx and a cast to unsigned long
> everywhere...
> </bikeshed>
> 
> Unless someone else has a concern that 'XID is not the same size as
> 'int', we should probably just use %x and eliminate the ugly cast.
> 
Using %x for XID will get a warning on 32-bit, AFAICT.
%lx and cast of XID to unsigned long seems like the least bad solution
to me.  Or, a PRIxXID macro that's "lx" on 32bit and "x" on 64bit (like
the stuff in <inttypes.h>).

Cheers,
Julien


More information about the xorg-devel mailing list