Rémi Bernon : winebus.sys: Use a local variable to access hid_device_state.
Alexandre Julliard
julliard at winehq.org
Tue Feb 22 16:06:52 CST 2022
Module: wine
Branch: master
Commit: 389b962f2acff689f8b7e9c2070f8af44c69e05d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=389b962f2acff689f8b7e9c2070f8af44c69e05d
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Tue Feb 22 13:04:28 2022 +0100
winebus.sys: Use a local variable to access hid_device_state.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winebus.sys/hid.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c
index 64e4f2955ae..df648a2019a 100644
--- a/dlls/winebus.sys/hid.c
+++ b/dlls/winebus.sys/hid.c
@@ -237,28 +237,29 @@ BOOL hid_device_add_hatswitch(struct unix_device *iface, INT count)
static BOOL hid_device_add_axis_count(struct unix_device *iface, BOOL rel, BYTE count)
{
- USHORT offset = iface->hid_device_state.bit_size / 8;
+ struct hid_device_state *state = &iface->hid_device_state;
+ USHORT offset = state->bit_size / 8;
- if (!rel && iface->hid_device_state.rel_axis_count)
+ if (!rel && state->rel_axis_count)
ERR("absolute axes should be added before relative axes!\n");
- else if (iface->hid_device_state.button_count || iface->hid_device_state.hatswitch_count)
+ else if (state->button_count || state->hatswitch_count)
ERR("axes should be added before buttons or hatswitches!\n");
- else if ((iface->hid_device_state.bit_size % 8))
+ else if ((state->bit_size % 8))
ERR("axes should be byte aligned, missing padding!\n");
- else if (iface->hid_device_state.bit_size + 32 * count > 0x80000)
+ else if (state->bit_size + 32 * count > 0x80000)
ERR("report size overflow, too many elements!\n");
else if (rel)
{
- if (!iface->hid_device_state.rel_axis_count) iface->hid_device_state.rel_axis_start = offset;
- iface->hid_device_state.rel_axis_count += count;
- iface->hid_device_state.bit_size += 32 * count;
+ if (!state->rel_axis_count) state->rel_axis_start = offset;
+ state->rel_axis_count += count;
+ state->bit_size += 32 * count;
return TRUE;
}
else
{
- if (!iface->hid_device_state.abs_axis_count) iface->hid_device_state.abs_axis_start = offset;
- iface->hid_device_state.abs_axis_count += count;
- iface->hid_device_state.bit_size += 32 * count;
+ if (!state->abs_axis_count) state->abs_axis_start = offset;
+ state->abs_axis_count += count;
+ state->bit_size += 32 * count;
return TRUE;
}
More information about the wine-cvs
mailing list