Commit 5c5f7fcb7c35a46efd05e840e593871538242b78

Ran Benita 2012-04-01T16:48:34

makekeys: use correct format strings The new glibc (2.15) appear to cause trouble, particularly the sscanf call, where makekeys will output empty hash tables. Using the appropriate macros from inttypes.h makes it work again. Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/makekeys/makekeys.c b/makekeys/makekeys.c
index 35bd66d..1b873aa 100644
--- a/makekeys/makekeys.c
+++ b/makekeys/makekeys.c
@@ -66,7 +66,7 @@ parse_line(const char *buf, char *key, xkb_keysym_t *val, char *prefix)
 
     /* See if we can catch a straight XK_foo 0x1234-style definition first;
      * the trickery around tmp is to account for prefices. */
-    i = sscanf(buf, "#define %127s 0x%lx", key, val);
+    i = sscanf(buf, "#define %127s 0x%"SCNx32, key, val);
     if (i == 2 && (tmp = strstr(key, "XK_"))) {
         memcpy(prefix, key, tmp - key);
         prefix[tmp - key] = '\0';
@@ -131,7 +131,7 @@ main(int argc, char *argv[])
             if (val == XK_VoidSymbol)
                 val = 0;
             if (val > 0x1fffffff) {
-                fprintf(stderr, "ignoring illegal keysym (%s, %lx)\n", key,
+                fprintf(stderr, "ignoring illegal keysym (%s, %"PRIx32")\n", key,
                         val);
                 continue;
             }
@@ -223,10 +223,10 @@ next1:  ;
         offsets[j] = k;
         indexes[i] = k;
         val = info[i].val;
-        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);
+        printf("0x%.2"PRIx32", 0x%.2"PRIx32", 0x%.2"PRIx32", "
+               "0x%.2"PRIx32", 0x%.2"PRIx32", 0x%.2"PRIx32", ",
+               (sig >> 8) & 0xff, sig & 0xff, (val >> 24) & 0xff,
+               (val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff);
         for (name = info[i].name, k += 7; (c = *name++); k++)
             printf("'%c',", c);
         printf((i == (ksnum-1)) ? "0\n" : "0,\n");