mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-24 15:50:08 +01:00
Use libevdev_get_event_type_max from libevdev_get_event_code_name
This will check for invalid types for us, and we can do a better check for signed/unsigned comparison. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
4b715dd928
commit
fa4cadae60
1 changed files with 2 additions and 3 deletions
|
|
@ -1190,10 +1190,9 @@ libevdev_get_event_type_name(unsigned int type)
|
|||
const char*
|
||||
libevdev_get_event_code_name(unsigned int type, unsigned int code)
|
||||
{
|
||||
if (type > EV_MAX)
|
||||
return NULL;
|
||||
int max = libevdev_get_event_type_max(type);
|
||||
|
||||
if (code > ev_max[type])
|
||||
if (max == -1 || code > (unsigned int)max)
|
||||
return NULL;
|
||||
|
||||
return event_type_map[type][code];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue