[PATCH 06/12] dmx: more unshadowing of variables

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


Gets rid of gcc 4.8 warnings:

dmxinputinit.c: In function ‘dmxInputScanForExtensions’:
dmxinputinit.c:877:14: warning: declaration of ‘display’ shadows a global declaration [-Wshadow]
     Display *display;
              ^
In file included from ../../../include/windowstr.h:60:0,
                 from dmxinputinit.c:72:
../../../include/opaque.h:52:30: warning: shadowed declaration is here [-Wshadow]
 extern _X_EXPORT const char *display;
                              ^

glxcmds.c: In function ‘__glXCreatePbuffer’:
glxcmds.c:3397:21: warning: declaration of ‘pc’ shadows a parameter [-Wshadow]
             CARD32 *pc = (CARD32 *) (be_req + 1);
                     ^
glxcmds.c:3314:52: warning: shadowed declaration is here [-Wshadow]
 __glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
                                                    ^

glxscreens.c: In function ‘CalcServerVersionAndExtensions’:
glxscreens.c:139:35: warning: declaration of ‘req’ shadows a previous local [-Wshadow]
         xGLXQueryServerStringReq *req;
                                   ^
glxscreens.c:68:26: warning: shadowed declaration is here [-Wshadow]
     xGLXQueryVersionReq *req;
                          ^
glxscreens.c:140:36: warning: declaration of ‘reply’ shadows a previous local [-Wshadow]
         xGLXQueryServerStringReply reply;
                                    ^
glxscreens.c:69:27: warning: shadowed declaration is here [-Wshadow]
     xGLXQueryVersionReply reply;
                           ^

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 hw/dmx/glxProxy/glxcmds.c    |    6 +++---
 hw/dmx/glxProxy/glxscreens.c |    4 ++--
 hw/dmx/input/dmxinputinit.c  |   10 +++++-----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index fb4d5ac..88c2eb1 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -3394,11 +3394,11 @@ __glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
 
         /* Send attributes */
         if (attr != NULL) {
-            CARD32 *pc = (CARD32 *) (be_req + 1);
+            CARD32 *pca = (CARD32 *) (be_req + 1);
 
             while (numAttribs-- > 0) {
-                *pc++ = *attr++;        /* token */
-                *pc++ = *attr++;        /* value */
+                *pca++ = *attr++;        /* token */
+                *pca++ = *attr++;        /* value */
             }
         }
 
diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c
index 138afed..b62776c 100644
--- a/hw/dmx/glxProxy/glxscreens.c
+++ b/hw/dmx/glxProxy/glxscreens.c
@@ -65,8 +65,6 @@ static void
 CalcServerVersionAndExtensions(void)
 {
     int s;
-    xGLXQueryVersionReq *req;
-    xGLXQueryVersionReply reply;
     char **be_extensions;
     char *ext;
     char *denied_extensions;
@@ -80,6 +78,8 @@ CalcServerVersionAndExtensions(void)
     for (s = 0; s < __glXNumActiveScreens; s++) {
         DMXScreenInfo *dmxScreen = &dmxScreens[s];
         Display *dpy = dmxScreen->beDisplay;
+        xGLXQueryVersionReq *req;
+        xGLXQueryVersionReply reply;
 
         /* Send the glXQueryVersion request */
         LockDisplay(dpy);
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index abb6a85..56a39df 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -874,17 +874,17 @@ dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
 {
     XExtensionVersion *ext;
     XDeviceInfo *devices;
-    Display *display;
+    Display *dsp;
     int num;
     int i, j;
     XextErrorHandler handler;
 
-    if (!(display = XOpenDisplay(dmxInput->name)))
+    if (!(dsp = XOpenDisplay(dmxInput->name)))
         return;
 
     /* Print out information about the XInput Extension. */
     handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
-    ext = XGetExtensionVersion(display, INAME);
+    ext = XGetExtensionVersion(dsp, INAME);
     XSetExtensionErrorHandler(handler);
 
     if (!ext || ext == (XExtensionVersion *) NoSuchExtension) {
@@ -894,7 +894,7 @@ dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
         dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n",
                     dmxInput->name, INAME,
                     ext->major_version, ext->minor_version);
-        devices = XListInputDevices(display, &num);
+        devices = XListInputDevices(dsp, &num);
 
         XFree(ext);
         ext = NULL;
@@ -956,7 +956,7 @@ dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
         }
         XFreeDeviceList(devices);
     }
-    XCloseDisplay(display);
+    XCloseDisplay(dsp);
 }
 
 /** Re-initialize all the devices described in \a dmxInput.  Called from
-- 
1.7.9.2



More information about the xorg-devel mailing list