[PATCH libxkbcommon 1/4 v2] makekeys: Fix build/target word size mismatch when cross-compiling
Ran Benita
ran234 at gmail.com
Sun Feb 26 11:14:39 PST 2012
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 at gmail.com>
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
Signed-off-by: Ran Benita <ran234 at gmail.com>
---
v2:
- Remove the 'register' keyword, from a previous patch I forgot
to include, and needed for the next one's to apply cleanly.
- Don't single out gcc in the commit message.
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 <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;
--
1.7.9.2
More information about the xorg-devel
mailing list