[PATCH 3/5] winebus.sys: Fix warnings with long integer types.

Rémi Bernon rbernon at codeweavers.com
Mon Jan 31 03:10:59 CST 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/winebus.sys/Makefile.in    |  1 -
 dlls/winebus.sys/bus_iohid.c    |  2 +-
 dlls/winebus.sys/bus_sdl.c      |  2 +-
 dlls/winebus.sys/bus_udev.c     | 10 ++++-----
 dlls/winebus.sys/hid.c          |  2 +-
 dlls/winebus.sys/main.c         | 36 ++++++++++++++++-----------------
 dlls/winebus.sys/unix_private.h | 10 ++++-----
 dlls/winebus.sys/unixlib.c      |  4 ++--
 dlls/winebus.sys/unixlib.h      | 16 +++++++--------
 9 files changed, 41 insertions(+), 42 deletions(-)

diff --git a/dlls/winebus.sys/Makefile.in b/dlls/winebus.sys/Makefile.in
index 6eaaa248c0c..d9ea33d267d 100644
--- a/dlls/winebus.sys/Makefile.in
+++ b/dlls/winebus.sys/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 MODULE    = winebus.sys
 UNIXLIB   = winebus.so
 IMPORTS   = ntoskrnl hidparse
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c
index 735fd8c54cc..e0527739199 100644
--- a/dlls/winebus.sys/bus_iohid.c
+++ b/dlls/winebus.sys/bus_iohid.c
@@ -183,7 +183,7 @@ static void iohid_device_stop(struct unix_device *iface)
 }
 
 static NTSTATUS iohid_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer,
-                                                   DWORD length, DWORD *out_length)
+                                                   UINT length, UINT *out_length)
 {
     struct iohid_device *impl = impl_from_unix_device(iface);
     CFDataRef data = IOHIDDeviceGetProperty(impl->device, CFSTR(kIOHIDReportDescriptorKey));
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
index 37d75d0bc95..eba8a959cb4 100644
--- a/dlls/winebus.sys/bus_sdl.c
+++ b/dlls/winebus.sys/bus_sdl.c
@@ -400,7 +400,7 @@ static void sdl_device_stop(struct unix_device *iface)
     pthread_mutex_unlock(&sdl_cs);
 }
 
-NTSTATUS sdl_device_haptics_start(struct unix_device *iface, DWORD duration_ms,
+NTSTATUS sdl_device_haptics_start(struct unix_device *iface, UINT duration_ms,
                                   USHORT rumble_intensity, USHORT buzz_intensity)
 {
     struct sdl_device *impl = impl_from_unix_device(iface);
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c
index c6185adf23d..9881b625086 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -296,7 +296,7 @@ static void hidraw_device_stop(struct unix_device *iface)
 }
 
 static NTSTATUS hidraw_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer,
-                                                    DWORD length, DWORD *out_length)
+                                                    UINT length, UINT *out_length)
 {
 #ifdef HAVE_LINUX_HIDRAW_H
     struct hidraw_report_descriptor descriptor;
@@ -415,7 +415,7 @@ static void hidraw_disable_sony_quirks(struct unix_device *iface)
 static void hidraw_device_set_output_report(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io)
 {
     struct hidraw_device *impl = hidraw_impl_from_unix_device(iface);
-    ULONG length = packet->reportBufferLen;
+    unsigned int length = packet->reportBufferLen;
     BYTE buffer[8192];
     int count = 0;
 
@@ -448,7 +448,7 @@ static void hidraw_device_get_feature_report(struct unix_device *iface, HID_XFER
 {
 #if defined(HAVE_LINUX_HIDRAW_H) && defined(HIDIOCGFEATURE)
     struct hidraw_device *impl = hidraw_impl_from_unix_device(iface);
-    ULONG length = packet->reportBufferLen;
+    unsigned int length = packet->reportBufferLen;
     BYTE buffer[8192];
     int count = 0;
 
@@ -485,7 +485,7 @@ static void hidraw_device_set_feature_report(struct unix_device *iface, HID_XFER
 {
 #if defined(HAVE_LINUX_HIDRAW_H) && defined(HIDIOCSFEATURE)
     struct hidraw_device *impl = hidraw_impl_from_unix_device(iface);
-    ULONG length = packet->reportBufferLen;
+    unsigned int length = packet->reportBufferLen;
     BYTE buffer[8192];
     int count = 0;
 
@@ -865,7 +865,7 @@ static void lnxev_device_read_report(struct unix_device *iface)
         bus_event_queue_input_report(&event_queue, iface, state->report_buf, state->report_len);
 }
 
-static NTSTATUS lnxev_device_haptics_start(struct unix_device *iface, DWORD duration_ms,
+static NTSTATUS lnxev_device_haptics_start(struct unix_device *iface, UINT duration_ms,
                                            USHORT rumble_intensity, USHORT buzz_intensity)
 {
     struct lnxev_device *impl = lnxev_impl_from_unix_device(iface);
diff --git a/dlls/winebus.sys/hid.c b/dlls/winebus.sys/hid.c
index 32628f1f2fd..3be2ca304d5 100644
--- a/dlls/winebus.sys/hid.c
+++ b/dlls/winebus.sys/hid.c
@@ -1025,7 +1025,7 @@ static void hid_device_stop(struct unix_device *iface)
     iface->hid_vtbl->stop(iface);
 }
 
-NTSTATUS hid_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length)
+NTSTATUS hid_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer, UINT length, UINT *out_length)
 {
     *out_length = iface->hid_report_descriptor.size;
     if (length < iface->hid_report_descriptor.size) return STATUS_BUFFER_TOO_SMALL;
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 111953c3bae..d1eec8c29bb 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -79,7 +79,7 @@ struct device_extension
     DWORD index;
 
     BYTE *report_desc;
-    ULONG report_desc_length;
+    UINT report_desc_length;
     HIDP_DEVICE_DESC collection_desc;
 
     struct hid_report *last_reports[256];
@@ -120,7 +120,7 @@ static NTSTATUS unix_device_start(DEVICE_OBJECT *device)
     return winebus_call(device_start, ext->unix_device);
 }
 
-static NTSTATUS unix_device_get_report_descriptor(DEVICE_OBJECT *device, BYTE *buffer, DWORD length, DWORD *out_length)
+static NTSTATUS unix_device_get_report_descriptor(DEVICE_OBJECT *device, BYTE *buffer, UINT length, UINT *out_length)
 {
     struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
     struct device_descriptor_params params =
@@ -299,7 +299,7 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni
     status = IoCreateDevice(driver_obj, sizeof(struct device_extension), &nameW, 0, 0, FALSE, &device);
     if (status)
     {
-        FIXME("failed to create device error %x\n", status);
+        FIXME("failed to create device error %#lx\n", status);
         return NULL;
     }
 
@@ -413,7 +413,7 @@ static BOOL deliver_next_report(struct device_extension *ext, IRP *irp)
 
     if (TRACE_ON(hid))
     {
-        TRACE("read input report length %u:\n", report->length);
+        TRACE("read input report length %lu:\n", report->length);
         for (i = 0; i < report->length;)
         {
             char buffer[256], *buf = buffer;
@@ -558,7 +558,7 @@ static DWORD CALLBACK bus_main_thread(void *args)
     TRACE("%s main loop started\n", debugstr_w(bus.name));
 
     bus.bus_event->type = BUS_EVENT_TYPE_NONE;
-    if (status) WARN("%s bus init returned status %#x\n", debugstr_w(bus.name), status);
+    if (status) WARN("%s bus init returned status %#lx\n", debugstr_w(bus.name), status);
     else while ((status = winebus_call(bus.wait_code, bus.bus_event)) == STATUS_PENDING)
     {
         struct bus_event *event = bus.bus_event;
@@ -592,7 +592,7 @@ static DWORD CALLBACK bus_main_thread(void *args)
         }
     }
 
-    if (status) WARN("%s bus wait returned status %#x\n", debugstr_w(bus.name), status);
+    if (status) WARN("%s bus wait returned status %#lx\n", debugstr_w(bus.name), status);
     else TRACE("%s main loop exited\n", debugstr_w(bus.name));
     RtlFreeHeap(GetProcessHeap(), 0, bus.bus_event);
     return status;
@@ -837,20 +837,20 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp)
             if (ext->state != DEVICE_STATE_STOPPED) status = STATUS_SUCCESS;
             else if (ext->state == DEVICE_STATE_REMOVED) status = STATUS_DELETE_PENDING;
             else if ((status = unix_device_start(device)))
-                ERR("Failed to start device %p, status %#x\n", device, status);
+                ERR("Failed to start device %p, status %#lx\n", device, status);
             else
             {
                 status = unix_device_get_report_descriptor(device, NULL, 0, &ext->report_desc_length);
                 if (status != STATUS_SUCCESS && status != STATUS_BUFFER_TOO_SMALL)
-                    ERR("Failed to get device %p report descriptor, status %#x\n", device, status);
+                    ERR("Failed to get device %p report descriptor, status %#lx\n", device, status);
                 else if (!(ext->report_desc = RtlAllocateHeap(GetProcessHeap(), 0, ext->report_desc_length)))
                     status = STATUS_NO_MEMORY;
                 else if ((status = unix_device_get_report_descriptor(device, ext->report_desc, ext->report_desc_length,
                                                                      &ext->report_desc_length)))
-                    ERR("Failed to get device %p report descriptor, status %#x\n", device, status);
+                    ERR("Failed to get device %p report descriptor, status %#lx\n", device, status);
                 else if ((status = HidP_GetCollectionDescription(ext->report_desc, ext->report_desc_length,
                                                                  PagedPool, &ext->collection_desc)) != HIDP_STATUS_SUCCESS)
-                    ERR("Failed to parse device %p report descriptor, status %#x\n", device, status);
+                    ERR("Failed to parse device %p report descriptor, status %#lx\n", device, status);
                 else
                 {
                     status = STATUS_SUCCESS;
@@ -1032,7 +1032,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
             break;
         case IOCTL_HID_GET_STRING:
         {
-            DWORD index = (ULONG_PTR)irpsp->Parameters.DeviceIoControl.Type3InputBuffer;
+            UINT index = (UINT_PTR)irpsp->Parameters.DeviceIoControl.Type3InputBuffer;
             TRACE("IOCTL_HID_GET_STRING[%08x]\n", index);
 
             irp->IoStatus.Status = hid_get_device_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len);
@@ -1050,7 +1050,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
             irp->IoStatus.Status = STATUS_SUCCESS;
             if (TRACE_ON(hid))
             {
-                TRACE("read input report id %u length %u:\n", packet->reportId, packet->reportBufferLen);
+                TRACE("read input report id %u length %lu:\n", packet->reportId, packet->reportBufferLen);
                 for (i = 0; i < packet->reportBufferLen;)
                 {
                     char buffer[256], *buf = buffer;
@@ -1080,7 +1080,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
             HID_XFER_PACKET *packet = (HID_XFER_PACKET *)irp->UserBuffer;
             if (TRACE_ON(hid))
             {
-                TRACE("write output report id %u length %u:\n", packet->reportId, packet->reportBufferLen);
+                TRACE("write output report id %u length %lu:\n", packet->reportId, packet->reportBufferLen);
                 for (i = 0; i < packet->reportBufferLen;)
                 {
                     char buffer[256], *buf = buffer;
@@ -1099,7 +1099,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
             unix_device_get_feature_report(device, packet, &irp->IoStatus);
             if (!irp->IoStatus.Status && TRACE_ON(hid))
             {
-                TRACE("read feature report id %u length %u:\n", packet->reportId, packet->reportBufferLen);
+                TRACE("read feature report id %u length %lu:\n", packet->reportId, packet->reportBufferLen);
                 for (i = 0; i < packet->reportBufferLen;)
                 {
                     char buffer[256], *buf = buffer;
@@ -1116,7 +1116,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
             HID_XFER_PACKET *packet = (HID_XFER_PACKET *)irp->UserBuffer;
             if (TRACE_ON(hid))
             {
-                TRACE("write feature report id %u length %u:\n", packet->reportId, packet->reportBufferLen);
+                TRACE("write feature report id %u length %lu:\n", packet->reportId, packet->reportBufferLen);
                 for (i = 0; i < packet->reportBufferLen;)
                 {
                     char buffer[256], *buf = buffer;
@@ -1130,7 +1130,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
             break;
         }
         default:
-            FIXME("Unsupported ioctl %x (device=%x access=%x func=%x method=%x)\n",
+            FIXME("Unsupported ioctl %lx (device=%lx access=%lx func=%lx method=%lx)\n",
                   code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3);
             break;
     }
@@ -1150,7 +1150,7 @@ static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *p
 
     if ((ret = IoCreateDevice(driver, 0, NULL, FILE_DEVICE_BUS_EXTENDER, 0, FALSE, &bus_fdo)))
     {
-        ERR("Failed to create FDO, status %#x.\n", ret);
+        ERR("Failed to create FDO, status %#lx.\n", ret);
         return ret;
     }
 
@@ -1183,7 +1183,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
     attr.ObjectName = path;
     attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE;
     if ((ret = NtOpenKey(&driver_key, KEY_ALL_ACCESS, &attr)) != STATUS_SUCCESS)
-        ERR("Failed to open driver key, status %#x.\n", ret);
+        ERR("Failed to open driver key, status %#lx.\n", ret);
 
     driver_obj = driver;
 
diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h
index e897251dea8..ff57e537ffe 100644
--- a/dlls/winebus.sys/unix_private.h
+++ b/dlls/winebus.sys/unix_private.h
@@ -94,7 +94,7 @@ struct raw_device_vtbl
     void (*destroy)(struct unix_device *iface);
     NTSTATUS (*start)(struct unix_device *iface);
     void (*stop)(struct unix_device *iface);
-    NTSTATUS (*get_report_descriptor)(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length);
+    NTSTATUS (*get_report_descriptor)(struct unix_device *iface, BYTE *buffer, UINT length, UINT *out_length);
     void (*set_output_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io);
     void (*get_feature_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io);
     void (*set_feature_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io);
@@ -105,7 +105,7 @@ struct hid_device_vtbl
     void (*destroy)(struct unix_device *iface);
     NTSTATUS (*start)(struct unix_device *iface);
     void (*stop)(struct unix_device *iface);
-    NTSTATUS (*haptics_start)(struct unix_device *iface, DWORD duration_ms,
+    NTSTATUS (*haptics_start)(struct unix_device *iface, UINT duration_ms,
                               USHORT rumble_intensity, USHORT buzz_intensity);
     NTSTATUS (*physical_device_control)(struct unix_device *iface, USAGE control);
     NTSTATUS (*physical_device_set_gain)(struct unix_device *iface, BYTE percent);
@@ -132,9 +132,9 @@ enum haptics_waveform_index
 
 struct hid_haptics_features
 {
-    WORD  waveform_list[HAPTICS_WAVEFORM_LAST_INDEX - HAPTICS_WAVEFORM_NULL_INDEX];
-    WORD  duration_list[HAPTICS_WAVEFORM_LAST_INDEX - HAPTICS_WAVEFORM_NULL_INDEX];
-    DWORD waveform_cutoff_time_ms;
+    WORD waveform_list[HAPTICS_WAVEFORM_LAST_INDEX - HAPTICS_WAVEFORM_NULL_INDEX];
+    WORD duration_list[HAPTICS_WAVEFORM_LAST_INDEX - HAPTICS_WAVEFORM_NULL_INDEX];
+    UINT waveform_cutoff_time_ms;
 };
 
 struct hid_haptics_waveform
diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c
index 3a7c3a16428..96bd41e67f7 100644
--- a/dlls/winebus.sys/unixlib.c
+++ b/dlls/winebus.sys/unixlib.c
@@ -101,7 +101,7 @@ static void mouse_stop(struct unix_device *iface)
 {
 }
 
-static NTSTATUS mouse_haptics_start(struct unix_device *iface, DWORD duration,
+static NTSTATUS mouse_haptics_start(struct unix_device *iface, UINT duration,
                                     USHORT rumble_intensity, USHORT buzz_intensity)
 {
     return STATUS_NOT_SUPPORTED;
@@ -184,7 +184,7 @@ static void keyboard_stop(struct unix_device *iface)
 {
 }
 
-static NTSTATUS keyboard_haptics_start(struct unix_device *iface, DWORD duration,
+static NTSTATUS keyboard_haptics_start(struct unix_device *iface, UINT duration,
                                        USHORT rumble_intensity, USHORT buzz_intensity)
 {
     return STATUS_NOT_SUPPORTED;
diff --git a/dlls/winebus.sys/unixlib.h b/dlls/winebus.sys/unixlib.h
index 11a4efac36e..a84a3331a25 100644
--- a/dlls/winebus.sys/unixlib.h
+++ b/dlls/winebus.sys/unixlib.h
@@ -32,11 +32,11 @@
 
 struct device_desc
 {
-    DWORD vid;
-    DWORD pid;
-    DWORD version;
-    DWORD input;
-    DWORD uid;
+    UINT vid;
+    UINT pid;
+    UINT version;
+    UINT input;
+    UINT uid;
     BOOL is_gamepad;
 
     WCHAR manufacturer[MAX_PATH];
@@ -48,7 +48,7 @@ struct sdl_bus_options
 {
     BOOL map_controllers;
     /* freed after bus_init */
-    DWORD mappings_count;
+    UINT mappings_count;
     char **mappings;
 };
 
@@ -104,8 +104,8 @@ struct device_descriptor_params
 {
     struct unix_device *iface;
     BYTE *buffer;
-    DWORD length;
-    DWORD *out_length;
+    UINT length;
+    UINT *out_length;
 };
 
 struct device_report_params
-- 
2.34.1




More information about the wine-devel mailing list