Commit bbdec47b authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winebus.sys: Fix incorrect hid_device_set index check.

Instead of checking it in set_report_from_joystick_event.
parent f79d4343
......@@ -841,8 +841,7 @@ static BOOL set_report_from_joystick_event(struct sdl_device *impl, SDL_Event *e
{
SDL_JoyAxisEvent *ie = &event->jaxis;
if (ie->axis >= ARRAY_SIZE(absolute_axis_usages)) break;
hid_device_set_abs_axis(iface, ie->axis, ie->value);
if (!hid_device_set_abs_axis(iface, ie->axis, ie->value)) break;
bus_event_queue_input_report(&event_queue, iface, state->report_buf, state->report_len);
break;
}
......@@ -850,8 +849,7 @@ static BOOL set_report_from_joystick_event(struct sdl_device *impl, SDL_Event *e
{
SDL_JoyBallEvent *ie = &event->jball;
if (ie->ball >= ARRAY_SIZE(relative_axis_usages) / 2) break;
hid_device_set_rel_axis(iface, 2 * ie->ball, ie->xrel);
if (!hid_device_set_rel_axis(iface, 2 * ie->ball, ie->xrel)) break;
hid_device_set_rel_axis(iface, 2 * ie->ball + 1, ie->yrel);
bus_event_queue_input_report(&event_queue, iface, state->report_buf, state->report_len);
break;
......
......@@ -1376,7 +1376,7 @@ BOOL hid_device_set_abs_axis(struct unix_device *iface, ULONG index, LONG value)
{
struct hid_device_state *state = &iface->hid_device_state;
ULONG offset = state->abs_axis_start + index * 4;
if (index > state->abs_axis_count) return FALSE;
if (index >= state->abs_axis_count) return FALSE;
*(ULONG *)(state->report_buf + offset) = LE_ULONG(value);
return TRUE;
}
......@@ -1385,7 +1385,7 @@ BOOL hid_device_set_rel_axis(struct unix_device *iface, ULONG index, LONG value)
{
struct hid_device_state *state = &iface->hid_device_state;
ULONG offset = state->rel_axis_start + index * 4;
if (index > state->rel_axis_count) return FALSE;
if (index >= state->rel_axis_count) return FALSE;
*(ULONG *)(state->report_buf + offset) = LE_ULONG(value);
return TRUE;
}
......@@ -1395,7 +1395,7 @@ BOOL hid_device_set_button(struct unix_device *iface, ULONG index, BOOL is_set)
struct hid_device_state *state = &iface->hid_device_state;
ULONG offset = state->button_start + (index / 8);
BYTE mask = (1 << (index % 8));
if (index > state->button_count) return FALSE;
if (index >= state->button_count) return FALSE;
if (is_set) state->report_buf[offset] |= mask;
else state->report_buf[offset] &= ~mask;
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment