[PATCH:app/xlsclients] Use inttypes.h for correct printf formats

Alan Coopersmith Alan.Coopersmith at Sun.COM
Tue Oct 20 21:12:31 PDT 2009


This is going to become the xlsclients 2.0 branch - it could be argued
that anyone who doesn't have C99 support could continue to maintain a
xlsclients 1.0.x branch along with anyone who isn't ready to depend on
libxcb.   In this case though, is it that hard to provide compatibility
for non-C99 platforms?

#ifndef PRIx32
#define	PRIx32 "x"
#endif
#ifndef PRIu32
#define	PRIu32 "u"
#endif

	-alan-

Jeremy Huddleston wrote:
> This is C99, right?  If so, I don't think it's acceptable.
> 
> On Oct 20, 2009, at 18:56, Yaakov (Cygwin/X) wrote:
> 
>> From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
>>
>> xcb_atom_t and xcb_window_t are both typedef'd as uint32_t.
>>
>> Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
>> ---
>> xlsclients.c |    5 +++--
>> 1 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/xlsclients.c b/xlsclients.c
>> index 2452352..24f36f5 100644
>> --- a/xlsclients.c
>> +++ b/xlsclients.c
>> @@ -34,6 +34,7 @@ in this Software without prior written authorization
>> from The Open Group.
>> #include <stdlib.h>
>> #include <string.h>
>> #include <ctype.h>
>> +#include <inttypes.h>
>> #include <xcb/xcb.h>
>> #include <xcb/xproto.h>
>> #include <xcb/xcb_atom.h>
>> @@ -442,7 +443,7 @@ show_client_properties(void *closure)
>>      * do header information
>>      */
>>     if (cs->verbose) {
>> -    printf ("Window 0x%lx:\n", cs->w);
>> +    printf ("Window 0x%" PRIx32 ":\n", cs->w);
>>     print_text_field (cs->c, "  Machine:  ", client_machine);
>>     if (name && name->type)
>>         print_text_field (cs->c, "  Name:  ", name);
>> @@ -645,5 +646,5 @@ unknown(xcb_connection_t *dpy, xcb_atom_t
>> actual_type, int actual_format)
>>     } else
>>         fputs (Nil, stdout);
>>     }
>> -    printf (" (%ld) or format %d>", actual_type, actual_format);
>> +    printf (" (%" PRIu32 ") or format %d>", actual_type, actual_format);
>> }
>> -- 
>> 1.6.4.2
>>
>> _______________________________________________
>> xorg-devel mailing list
>> xorg-devel at lists.x.org
>> http://lists.x.org/mailman/listinfo/xorg-devel
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering



More information about the xorg-devel mailing list