chiark / gitweb /
keymap: Fix parsing of hex scan codes in tables
authorMartin Pitt <martinpitt@gnome.org>
Fri, 19 Oct 2012 06:01:47 +0000 (08:01 +0200)
committerMartin Pitt <martinpitt@gnome.org>
Fri, 19 Oct 2012 06:01:47 +0000 (08:01 +0200)
Commit b1f87c76b1 changed sscanf from %i to %u, as scan codes are unsigned
numbers which can be > 0x7FFFFFFF. However, sscanf doesn't accept hexadecimal
numbers for %u. It works fine with %i, so revert this back.

src/udev/keymap/keymap.c

index 0db33b9a86beb3578654fb52b4fb399e102111f0..a6f97ddcef8ba287ecac1b0c89c93939d115100a 100644 (file)
@@ -204,11 +204,11 @@ static int merge_table(int fd, FILE *f) {
                 if (*p == '#' || *p == '\n')
                         continue;
 
-                if (sscanf(p, "%u %i", &scancode, &new_keycode) != 2) {
+                if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) {
                         char t[105] = "KEY_UNKNOWN";
                         const struct key *k;
 
-                        if (sscanf(p, "%u %100s", &scancode, t+4) != 2) {
+                        if (sscanf(p, "%i %100s", &scancode, t+4) != 2) {
                                 fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line);
                                 r = -1;
                                 continue;