Constify the syms_out argument to xkb_key_get_syms() The caller should not mess around with these as they come directly from our internal structs. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h
index 1391437..ebdefb0 100644
--- a/include/xkbcommon/xkbcommon.h
+++ b/include/xkbcommon/xkbcommon.h
@@ -447,7 +447,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
*/
_X_EXPORT unsigned int
xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
- xkb_keysym_t **syms_out);
+ const xkb_keysym_t **syms_out);
/**
* Modifier and group types for state objects. This enum is bitmaskable,
diff --git a/src/map.c b/src/map.c
index 8bb115e..cde9a6f 100644
--- a/src/map.c
+++ b/src/map.c
@@ -302,7 +302,7 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
*/
unsigned int
xkb_key_get_syms_by_level(struct xkb_keymap *xkb, xkb_keycode_t key, unsigned int group,
- unsigned int level, xkb_keysym_t **syms_out)
+ unsigned int level, const xkb_keysym_t **syms_out)
{
int num_syms;
@@ -329,7 +329,7 @@ err:
*/
unsigned int
xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
- xkb_keysym_t **syms_out)
+ const xkb_keysym_t **syms_out)
{
struct xkb_keymap *xkb = state->xkb;
int group;
diff --git a/src/xkballoc.h b/src/xkballoc.h
index 3d445b4..ec25d21 100644
--- a/src/xkballoc.h
+++ b/src/xkballoc.h
@@ -75,6 +75,6 @@ XkbcFreeServerMap(struct xkb_keymap * xkb);
extern unsigned int
xkb_key_get_syms_by_level(struct xkb_keymap *xkb, xkb_keycode_t key,
unsigned int group, unsigned int level,
- xkb_keysym_t **syms_out);
+ const xkb_keysym_t **syms_out);
#endif /* _XKBALLOC_H_ */
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 9157981..a38d29e 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -903,7 +903,7 @@ static struct xkb_sym_interpret *
FindInterpForKey(struct xkb_keymap *xkb, xkb_keycode_t key, uint32_t group, uint32_t level)
{
struct xkb_sym_interpret *ret = NULL;
- xkb_keysym_t *syms;
+ const xkb_keysym_t *syms;
int num_syms;
int i;