[vlc-commits] actions: fix pointer aliasing
Rémi Denis-Courmont
git at videolan.org
Sun Oct 27 19:24:03 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Oct 27 20:13:28 2019 +0200| [a934d9b9922342df84cd47529b673b67ce8479f5] | committer: Rémi Denis-Courmont
actions: fix pointer aliasing
Tree functions return pointers to void pointers.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a934d9b9922342df84cd47529b673b67ce8479f5
---
src/misc/actions.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/misc/actions.c b/src/misc/actions.c
index b6e76e75d9..54996e6ce8 100644
--- a/src/misc/actions.c
+++ b/src/misc/actions.c
@@ -403,16 +403,18 @@ static int vlc_key_to_action (vlc_object_t *obj, const char *varname,
vlc_value_t prevkey, vlc_value_t curkey, void *d)
{
void *const *map = d;
- const struct mapping **pent;
+ const void **pent;
uint32_t keycode = curkey.i_int;
pent = tfind (&keycode, map, keycmp);
if (pent == NULL)
return VLC_SUCCESS;
+ const struct mapping *ent = *pent;
+
(void) varname;
(void) prevkey;
- return var_SetInteger (obj, "key-action", (*pent)->action);
+ return var_SetInteger (obj, "key-action", ent->action);
}
/**
@@ -426,7 +428,7 @@ static int add_mapping (void **map, uint32_t keycode, vlc_action_id_t action)
entry->key = keycode;
entry->action = action;
- struct mapping **pent = tsearch (entry, map, keycmp);
+ void **pent = tsearch (entry, map, keycmp);
if (unlikely(pent == NULL))
return ENOMEM;
if (*pent != entry)
More information about the vlc-commits
mailing list