[PATCH libxkbcommon 1/4] makekeys: Fix build/target word size mismatch when cross-compiling

Ran Benita ran234 at gmail.com
Sat Feb 25 14:25:47 PST 2012


This matches commit 24283d40b1e4314c6647dda49d2a159833341a8b from
libX11:

    Since makekeys is built using build environment's gcc 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. Also,
    eliminate the redundant multiple typedefs for the
    Signature type.

    Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

Signed-off-by: Ran Benita <ran234 at gmail.com>
---
 makekeys/makekeys.c |    5 +++--
 src/keysym.c        |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/makekeys/makekeys.c b/makekeys/makekeys.c
index 567843b..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
 
@@ -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;
-- 
1.7.9.2



More information about the xorg-devel mailing list