[PATCH 03/12] dmx: fix printf format argument warnings

Alan Coopersmith alan.coopersmith at oracle.com
Wed Dec 17 21:06:27 PST 2014


Gets rid of these gcc 4.8 warnings:

dmxinit.c: In function ‘dmxErrorHandler’:
dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
 but argument 3 has type ‘XID64’ [-Wformat=]
                ev->resourceid);
                ^
dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
 but argument 3 has type ‘XID64’ [-Wformat=]
                ev->resourceid);
                ^
dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
 but argument 3 has type ‘XID64’ [-Wformat=]
                ev->resourceid);
                ^
dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
 but argument 3 has type ‘long unsigned int’ [-Wformat=]
            ev->serial);
            ^
dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
 but argument 3 has type ‘long unsigned int’ [-Wformat=]
            dpy->request);
            ^
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
 but argument 3 has type ‘long unsigned int’ [-Wformat=]
         dmxLog(dmxInfo, "Generation:         %d\n", dmxGeneration);
         ^

dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
 unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
                        dmxScreen->name, win, tp.value);
                        ^
dmxprop.c: In function ‘dmxPropertyWindow’:
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
 unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
                other->index, other->name, other->scrnWin);
                ^
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
 unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 hw/dmx/dmxinit.c |   12 ++++++------
 hw/dmx/dmxprop.c |    6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index fd2ade0..37961b8 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -164,23 +164,23 @@ dmxErrorHandler(Display * dpy, XErrorEvent * ev)
     switch (ev->error_code) {
     case BadValue:
         dmxLog(dmxWarning, "                 Value:        0x%x\n",
-               ev->resourceid);
+               (unsigned int) ev->resourceid);
         break;
     case BadAtom:
         dmxLog(dmxWarning, "                 AtomID:       0x%x\n",
-               ev->resourceid);
+               (unsigned int) ev->resourceid);
         break;
     default:
         dmxLog(dmxWarning, "                 ResourceID:   0x%x\n",
-               ev->resourceid);
+               (unsigned int) ev->resourceid);
         break;
     }
 
     /* Provide serial number information */
     dmxLog(dmxWarning, "                 Failed serial number:  %d\n",
-           ev->serial);
+           (unsigned int) ev->serial);
     dmxLog(dmxWarning, "                 Current serial number: %d\n",
-           dpy->request);
+           (unsigned int) dpy->request);
     return 0;
 }
 
@@ -634,7 +634,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
         if (major > 0 && minor > 0)
             year += 2000;
 
-        dmxLog(dmxInfo, "Generation:         %d\n", dmxGeneration);
+        dmxLog(dmxInfo, "Generation:         %lu\n", dmxGeneration);
         dmxLog(dmxInfo, "DMX version:        %d.%d.%02d%02d%02d (%s)\n",
                major, minor, year, month, day, VENDOR_STRING);
 
diff --git a/hw/dmx/dmxprop.c b/hw/dmx/dmxprop.c
index 4be2dbd..5e306d2 100644
--- a/hw/dmx/dmxprop.c
+++ b/hw/dmx/dmxprop.c
@@ -220,7 +220,7 @@ dmxPropertyCheckOtherWindows(DMXScreenInfo * dmxScreen, Atom atom)
 
             if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) {
                 dmxLog(dmxDebug, "On %s/%lu: %s\n",
-                       dmxScreen->name, win, tp.value);
+                       dmxScreen->name, (unsigned long) win, tp.value);
                 if (!strncmp((char *) tp.value, (char *) id,
                              strlen((char *) id))) {
                     int idx;
@@ -360,8 +360,8 @@ dmxPropertyWindow(DMXScreenInfo * dmxScreen)
         dmxScreen->next = (other->next ? other->next : other);
         other->next = (tmp ? tmp : dmxScreen);
         dmxLog(dmxDebug, "%d/%s/%lu and %d/%s/%lu are on the same backend\n",
-               dmxScreen->index, dmxScreen->name, dmxScreen->scrnWin,
-               other->index, other->name, other->scrnWin);
+               dmxScreen->index, dmxScreen->name, (unsigned long) dmxScreen->scrnWin,
+               other->index, other->name, (unsigned long) other->scrnWin);
     }
 
     snprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index,
-- 
1.7.9.2



More information about the xorg-devel mailing list