[PATCH] libX11: do not shadow variables

walter harms wharms at bfs.de
Sat Jun 7 06:53:12 PDT 2014


unshadow a few variables that fixes:
imCallbk.c:627:15: warning: symbol 'len' shadows an earlier one
imCallbk.c:627:8: warning: declaration of 'len' shadows a parameter [-Wshadow]
imCallbk.c:597:9: warning: shadowed declaration is here [-Wshadow]
imLcLkup.c:64:18: warning: symbol 'mb' shadows an earlier one
imLcLkup.c:64:11: warning: declaration of 'mb' shadows a previous local [-Wshadow]
imLcLkup.c:53:11: warning: shadowed declaration is here [-Wshadow]
lcCT.c:1024:21: warning: symbol 'char_size' shadows an earlier one
lcCT.c:1024:21: warning: declaration of 'char_size' shadows a previous local [-Wshadow]
lcCT.c:884:9: warning: shadowed declaration is here [-Wshadow]
StrKeysym.c:118:14: warning: symbol 'c' shadows an earlier one
StrKeysym.c:118:7: warning: declaration of 'c' shadows a previous local [-Wshadow]
StrKeysym.c:80:18: warning: shadowed declaration is here [-Wshadow]


Signed-off-by: Harms <wharms at bfs,de>
---
 modules/im/ximcp/imCallbk.c | 6 +++---
 modules/im/ximcp/imLcLkup.c | 6 +++---
 src/StrKeysym.c             | 6 +++---
 src/xlibi18n/lcCT.c         | 5 +++--
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/modules/im/ximcp/imCallbk.c b/modules/im/ximcp/imCallbk.c
index 4e091d8..51430cb 100644
--- a/modules/im/ximcp/imCallbk.c
+++ b/modules/im/ximcp/imCallbk.c
@@ -624,16 +624,16 @@ _XimPreeditCaretCallback(Xim im,
      */
     {
 	CARD8 buf[sz_ximPacketHeader + sz_ximPreeditCaretReply];
-	INT16 len = sz_XIMID + sz_XICID + sz_ximPreeditCaretReply;
+	INT16 len16 = sz_XIMID + sz_XICID + sz_ximPreeditCaretReply;
 	int p;

-	_XimSetHeader((XPointer)buf, XIM_PREEDIT_CARET_REPLY, 0, &len);
+	_XimSetHeader((XPointer)buf, XIM_PREEDIT_CARET_REPLY, 0, &len16);
 	p = XIM_HEADER_SIZE;
 	*(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16;
 	*(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16;
 	*(CARD32*)&buf[p] = (CARD32)cbs.position;

-	if (!(_XimWriteData(im, len, buf))) {
+	if (!(_XimWriteData(im, len16, buf))) {
 	    return XimCbError;
 	}
 	_XimFlushData(im);
diff --git a/modules/im/ximcp/imLcLkup.c b/modules/im/ximcp/imLcLkup.c
index 9e4aec3..56dba96 100644
--- a/modules/im/ximcp/imLcLkup.c
+++ b/modules/im/ximcp/imLcLkup.c
@@ -61,8 +61,8 @@ _XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes,
 	    ||(ic->private.local.brl_committed != 0))) {
 	if (ic->private.local.brl_committed != 0) { /* Braille Event */
 	    unsigned char pattern = ic->private.local.brl_committed;
-	    char mb[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)];
-	    ret = _Xlcwctomb(ic->core.im->core.lcd, mb, BRL_UC_ROW | pattern);
+	    char mb2[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)];
+	    ret = _Xlcwctomb(ic->core.im->core.lcd, mb2, BRL_UC_ROW | pattern);
 	    if(ret > bytes) {
 		if(status) *status = XBufferOverflow;
 		return(ret);
@@ -74,7 +74,7 @@ _XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes,
 		} else {
 		    if(status) *status = XLookupChars;
 		}
-		memcpy(buffer, mb, ret);
+		memcpy(buffer, mb2, ret);
 	    } else {
 		if(keysym) {
 		    if(status) *status = XLookupKeySym;
diff --git a/src/StrKeysym.c b/src/StrKeysym.c
index 12fce68..9235558 100644
--- a/src/StrKeysym.c
+++ b/src/StrKeysym.c
@@ -77,14 +77,14 @@ XStringToKeysym(_Xconst char *s)
     int h;
     register Signature sig = 0;
     register const char *p = s;
-    register int c;
+    register int b;
     register int idx;
     const unsigned char *entry;
     unsigned char sig1, sig2;
     KeySym val;

-    while ((c = *p++))
-	sig = (sig << 1) + c;
+    while ((b = *p++))
+	sig = (sig << 1) + b;
     i = sig % KTABLESIZE;
     h = i + 1;
     sig1 = (sig >> 8) & 0xff;
diff --git a/src/xlibi18n/lcCT.c b/src/xlibi18n/lcCT.c
index b161300..e9db4f2 100644
--- a/src/xlibi18n/lcCT.c
+++ b/src/xlibi18n/lcCT.c
@@ -1021,13 +1021,14 @@ cstoct(
            ) {
             while (csstr_len > 0 && ct_len > 0) {
                 unsigned char ch = * (const unsigned char *) csptr;
-                int char_size = (ch < 0xc0 ? 1 :
+                int i;
+                     char_size = (ch < 0xc0 ? 1 :
                                  ch < 0xe0 ? 2 :
                                  ch < 0xf0 ? 3 :
                                  ch < 0xf8 ? 4 :
                                  ch < 0xfc ? 5 :
                                              6);
-                int i;
+
                 if (!(csstr_len >= char_size && ct_len >= char_size))
                     break;
                 for (i = char_size; i > 0; i--)
-- 
1.8.4.5



More information about the xorg-devel mailing list