From 04e687c9da4cd643779fa4571c7e452c4f7e2dc7 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 25 Feb 2012 21:09:28 +0200 Subject: [PATCH] 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 Reviewed-by: Daniel Stone Signed-off-by: Ran Benita --- makekeys/makekeys.c | 11 ++++++----- src/keysym.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) 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 #include #include +#include #include #include -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; -- 2.7.4