aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-02-15 23:43:12 -0800
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:26 +0200
commitd43f4c3980cb76f39167e18b20ccec23182ed582 (patch)
tree90a58db4cc91af4c043970a20fb3e078ec3a4bd7 /nx-X11
parent5e0584c43d3511a5544246a0f82c759ce860a0c2 (diff)
downloadnx-libs-d43f4c3980cb76f39167e18b20ccec23182ed582.tar.gz
nx-libs-d43f4c3980cb76f39167e18b20ccec23182ed582.tar.bz2
nx-libs-d43f4c3980cb76f39167e18b20ccec23182ed582.zip
XKeysymToString: move variable declarations to the scope of their usage
Makes it easier for readers to understand scope of variable usage, and clears up gcc warning: KeysymStr.c: In function 'XKeysymToString': KeysymStr.c:128:13: warning: declaration of 'i' shadows a previous local [-Wshadow] KeysymStr.c:73:18: warning: shadowed declaration is here [-Wshadow] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/lib/X11/KeysymStr.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/nx-X11/lib/X11/KeysymStr.c b/nx-X11/lib/X11/KeysymStr.c
index 96c49227a..797cf53bd 100644
--- a/nx-X11/lib/X11/KeysymStr.c
+++ b/nx-X11/lib/X11/KeysymStr.c
@@ -70,11 +70,6 @@ SameValue(
char *XKeysymToString(KeySym ks)
{
- register int i, n;
- int h;
- register int idx;
- const unsigned char *entry;
- unsigned char val1, val2, val3, val4;
XrmDatabase keysymdb;
if (!ks || (ks & ((unsigned long) ~0x1fffffff)) != 0)
@@ -83,16 +78,17 @@ char *XKeysymToString(KeySym ks)
ks = 0;
if (ks <= 0x1fffffff)
{
- val1 = ks >> 24;
- val2 = (ks >> 16) & 0xff;
- val3 = (ks >> 8) & 0xff;
- val4 = ks & 0xff;
- i = ks % VTABLESIZE;
- h = i + 1;
- n = VMAXHASH;
+ unsigned char val1 = ks >> 24;
+ unsigned char val2 = (ks >> 16) & 0xff;
+ unsigned char val3 = (ks >> 8) & 0xff;
+ unsigned char val4 = ks & 0xff;
+ int i = ks % VTABLESIZE;
+ int h = i + 1;
+ int n = VMAXHASH;
+ int idx;
while ((idx = hashKeysym[i]))
{
- entry = &_XkeyTable[idx];
+ const unsigned char *entry = &_XkeyTable[idx];
if ((entry[0] == val1) && (entry[1] == val2) &&
(entry[2] == val3) && (entry[3] == val4))
return ((char *)entry + 4);
@@ -136,7 +132,7 @@ char *XKeysymToString(KeySym ks)
i--;
s[i--] = '\0';
for (; i; i--){
- val1 = val & 0xf;
+ unsigned char val1 = val & 0xf;
val >>= 4;
if (val1 < 10)
s[i] = '0'+ val1;