action: fix printing of underflowed value in error message

Signed-off-by: Ran Benita <ran234@gmail.com>
action: fix misleading cast

The type is uint8_t and so is the checked range.

Signed-off-by: Ran Benita <ran234@gmail.com>
Use unsigned int for saving darray_size return value

See: b9b3593cbdeb7f5b02d50cecaba6a0b47d4979ad
So these should be unsigned int's now.

Signed-off-by: Ran Benita <ran234@gmail.com>
Use (1u << idx) instead of (1 << idx) where appropriate

It doesn't matter (I think), since the implicit conversion doesn't have
any effect (e.g. sign-extension). But it's better to be aware of the
type.

Signed-off-by: Ran Benita <ran234@gmail.com>
state: optimize xkb_state_led_update_all()

Before:
    ran@ran:~/src/libxkbcommon$ ./test/bench-key-proc
    ran 20000000 iterations in 6.623018074s

After:
    ran@ran:~/src/libxkbcommon$ ./test/bench-key-proc
    ran 20000000 iterations in 4.762291091s

Not that anyone needs to process millions of keys per second...

Signed-off-by: Ran Benita <ran234@gmail.com>
keysym: fix types in bin_search

Signed-off-by: Ran Benita <ran234@gmail.com>
x11: make msb_pos return unsigned

It was initially returning -1 for all-zero arguments, but now it returns
0.

Signed-off-by: Ran Benita <ran234@gmail.com>
x11: fix truncation of xkb controls mask off the wire

It's uint32_t, not uint16_t, so we were losing flags (not that it
matters in this case).

Signed-off-by: Ran Benita <ran234@gmail.com>
x11: make some #defines unsigned

Signed-off-by: Ran Benita <ran234@gmail.com>
x11: make sure not to use compat header

src/keymap.h already defines the necessary header guard, so just reverse
the include order.

Signed-off-by: Ran Benita <ran234@gmail.com>
api: deprecate XKB_MAP_COMPILE_PLACEHOLDER, and use KEYMAP instead of MAP

The PLACEHOLDER was not meant to be used, but c++ doesn't like passing 0
to enums, so it was used. For this reason we add all the NO_FLAGS items,
so the PLACEHOLDER shouldn't be used anymore.

Second, XKB_MAP is the prefix we used ages ago, KEYMAP is the expected
prefix here. So deprecate that as well.

The old names may still be used through the xkbcommon-compat.h header,
which is included by default (no need to include directly).

Signed-off-by: Ran Benita <ran234@gmail.com>
rules: get rid of struct location

Use the scanner token_{line,column} like we do in the other places.

Signed-off-by: Ran Benita <ran234@gmail.com>
scanner: make line and column unsigned

Signed-off-by: Ran Benita <ran234@gmail.com>
keysym: use safe keysym comparison function

Instead of thinking about signed <-> unsigned an whatnot.
bsearch() is inline in glibc, so gcc optimizes this away anyway.

Signed-off-by: Ran Benita <ran234@gmail.com>