Commit 04e687c9da4cd643779fa4571c7e452c4f7e2dc7

Ran Benita 2012-02-25T21:09:28

makekeys: Fix build/target word size mismatch when cross-compiling This matches commit 24283d40b1e4314c6647dda49d2a159833341a8b from libX11: Since makekeys is built using build environment's compiler and runs natively, we have to make sure that the size of the Signature type is the same on both the native environment and the target, otherwise we get mismatches upon running X, and some LSB test failures (xts5). Use an unsigned 32-bit integer on all platforms. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/makekeys/makekeys.c b/makekeys/makekeys.c
index 2cd1d9a..a25a4a6 100644
--- a/makekeys/makekeys.c
+++ b/makekeys/makekeys.c
@@ -31,10 +31,11 @@ from The Open Group.
 #include <X11/X.h>
 #include <X11/Xos.h>
 #include <X11/keysymdef.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-typedef unsigned long Signature;
+typedef uint32_t Signature;
 
 #define KTNUM 4000
 
@@ -171,9 +172,9 @@ main(int argc, char *argv[])
     int ksnum = 0;
     int max_rehash;
     Signature sig;
-    register int i, j, k, z;
-    register char *name;
-    register char c;
+    int i, j, k, z;
+    char *name;
+    char c;
     int first;
     int best_max_rehash;
     int best_z = 0;
@@ -287,7 +288,7 @@ next1:  ;
         offsets[j] = k;
         indexes[i] = k;
         val = info[i].val;
-        printf("0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ",
+        printf("0x%.2"PRIx32", 0x%.2"PRIx32", 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ",
                (sig >> 8) & 0xff, sig & 0xff,
                (val >> 24) & 0xff, (val >> 16) & 0xff,
                (val >> 8) & 0xff, val & 0xff);
diff --git a/src/keysym.c b/src/keysym.c
index 7580cdd..bd0a67b 100644
--- a/src/keysym.c
+++ b/src/keysym.c
@@ -95,7 +95,7 @@ uint32_t
 xkb_string_to_keysym(const char *s)
 {
     int i, n, h, c, idx;
-    unsigned long sig = 0;
+    uint32_t sig = 0;
     const char *p = s;
     const unsigned char *entry;
     unsigned char sig1, sig2;