diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-19 22:15:01 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-19 22:15:01 +0200 |
commit | 70ac75f4ab184c21d11b9840a47362610aaef481 (patch) | |
tree | 183b9ec7e6897fb2cea7296b461a35ca93dfce6e /nx-X11/lib/X11/KeysymStr.c | |
parent | 6c303d9e4ffd162b8c7f59a4b135e592d923a656 (diff) | |
parent | 70e9d346fe34af127d2c827c3678e53d0f4312ae (diff) | |
download | nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.tar.gz nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.tar.bz2 nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.zip |
Merge branch 'uli42-pr/libX11_further_backports' into 3.6.x
Attributes GH PR #222: https://github.com/ArcticaProject/nx-libs/pull/222
Diffstat (limited to 'nx-X11/lib/X11/KeysymStr.c')
-rw-r--r-- | nx-X11/lib/X11/KeysymStr.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/nx-X11/lib/X11/KeysymStr.c b/nx-X11/lib/X11/KeysymStr.c index 96c49227a..ba6c8450a 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); @@ -111,7 +107,7 @@ char *XKeysymToString(KeySym ks) XrmQuark empty = NULLQUARK; GRNData data; - sprintf(buf, "%lX", ks); + snprintf(buf, sizeof(buf), "%lX", ks); resval.addr = (XPointer)buf; resval.size = strlen(buf) + 1; data.name = (char *)NULL; @@ -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; |