state, map: check XkbKey != NULL where missing
Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
debd62b59b
commit
7dca986e3f
|
@ -219,6 +219,7 @@ XKB_EXPORT xkb_layout_index_t
|
||||||
xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc)
|
xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc)
|
||||||
{
|
{
|
||||||
const struct xkb_key *key = XkbKey(keymap, kc);
|
const struct xkb_key *key = XkbKey(keymap, kc);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -233,6 +234,7 @@ xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc,
|
||||||
xkb_layout_index_t layout)
|
xkb_layout_index_t layout)
|
||||||
{
|
{
|
||||||
const struct xkb_key *key = XkbKey(keymap, kc);
|
const struct xkb_key *key = XkbKey(keymap, kc);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -302,6 +304,8 @@ xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap,
|
||||||
const struct xkb_key *key = XkbKey(keymap, kc);
|
const struct xkb_key *key = XkbKey(keymap, kc);
|
||||||
int num_syms;
|
int num_syms;
|
||||||
|
|
||||||
|
if (!key)
|
||||||
|
goto err;
|
||||||
if (layout >= key->num_groups)
|
if (layout >= key->num_groups)
|
||||||
goto err;
|
goto err;
|
||||||
if (level >= XkbKeyGroupWidth(keymap, key, layout))
|
if (level >= XkbKeyGroupWidth(keymap, key, layout))
|
||||||
|
@ -326,6 +330,7 @@ XKB_EXPORT int
|
||||||
xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc)
|
xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc)
|
||||||
{
|
{
|
||||||
const struct xkb_key *key = XkbKey(keymap, kc);
|
const struct xkb_key *key = XkbKey(keymap, kc);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -149,11 +149,11 @@ xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t kc,
|
||||||
XKB_EXPORT xkb_layout_index_t
|
XKB_EXPORT xkb_layout_index_t
|
||||||
xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t kc)
|
xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t kc)
|
||||||
{
|
{
|
||||||
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
|
||||||
xkb_layout_index_t ret =
|
xkb_layout_index_t ret =
|
||||||
xkb_state_serialize_layout(state, XKB_STATE_EFFECTIVE);
|
xkb_state_serialize_layout(state, XKB_STATE_EFFECTIVE);
|
||||||
|
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
||||||
|
|
||||||
if (key->num_groups == 0)
|
if (!key || key->num_groups == 0)
|
||||||
return XKB_LAYOUT_INVALID;
|
return XKB_LAYOUT_INVALID;
|
||||||
|
|
||||||
if (ret < key->num_groups)
|
if (ret < key->num_groups)
|
||||||
|
@ -631,6 +631,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t kc,
|
||||||
xkb_mod_index_t i;
|
xkb_mod_index_t i;
|
||||||
xkb_mod_mask_t bit;
|
xkb_mod_mask_t bit;
|
||||||
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -713,6 +714,7 @@ xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t kc,
|
||||||
xkb_layout_index_t layout;
|
xkb_layout_index_t layout;
|
||||||
xkb_level_index_t level;
|
xkb_level_index_t level;
|
||||||
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -1010,6 +1012,7 @@ xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t kc,
|
||||||
xkb_mod_index_t idx)
|
xkb_mod_index_t idx)
|
||||||
{
|
{
|
||||||
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -1029,6 +1032,7 @@ xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t kc,
|
||||||
xkb_mod_mask_t mask)
|
xkb_mod_mask_t mask)
|
||||||
{
|
{
|
||||||
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
const struct xkb_key *key = XkbKey(state->keymap, kc);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue