parser: fix unrecognized keysym handling
Integer may be negative, so also need to test >= 0. Also, $$ was left uninitialized if the keysym wasn't recognized. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
5dbd136435
commit
5547a82f2a
|
@ -710,14 +710,20 @@ KeySym : IDENT
|
||||||
| SECTION { $$ = XKB_KEY_section; }
|
| SECTION { $$ = XKB_KEY_section; }
|
||||||
| Integer
|
| Integer
|
||||||
{
|
{
|
||||||
if ($1 < 10) { /* XKB_KEY_0 .. XKB_KEY_9 */
|
if ($1 < 0) {
|
||||||
$$ = XKB_KEY_0 + $1;
|
parser_warn(param, "unrecognized keysym");
|
||||||
|
$$ = XKB_KEY_NoSymbol;
|
||||||
|
}
|
||||||
|
else if ($1 < 10) { /* XKB_KEY_0 .. XKB_KEY_9 */
|
||||||
|
$$ = XKB_KEY_0 + (xkb_keysym_t) $1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char buf[17];
|
char buf[17];
|
||||||
snprintf(buf, sizeof(buf), "0x%x", $1);
|
snprintf(buf, sizeof(buf), "0x%x", $1);
|
||||||
if (!resolve_keysym(buf, &$$))
|
if (!resolve_keysym(buf, &$$)) {
|
||||||
parser_warn(param, "unrecognized keysym");
|
parser_warn(param, "unrecognized keysym");
|
||||||
|
$$ = XKB_KEY_NoSymbol;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue