[PATCH 2/4] winebus.sys: Use a local variable to access hid_device_state.

Rémi Bernon rbernon at codeweavers.com
Tue Feb 22 06:04:28 CST 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 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;
     }
 
-- 
2.34.1




More information about the wine-devel mailing list