From 4430187e8dbbac653fd5c4e7683afa5076e043e7 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 7 Feb 2019 14:32:38 +0100 Subject: [PATCH] Fixed sign-compare warnings --- channels/urbdrc/client/data_transfer.c | 5 +++-- channels/urbdrc/client/libusb/libusb_udevice.c | 18 ++++++++++-------- channels/urbdrc/client/urbdrc_main.c | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/channels/urbdrc/client/data_transfer.c b/channels/urbdrc/client/data_transfer.c index 47ab753..336b7c0 100644 --- a/channels/urbdrc/client/data_transfer.c +++ b/channels/urbdrc/client/data_transfer.c @@ -213,7 +213,8 @@ static int urbdrc_process_io_control(URBDRC_CHANNEL_CALLBACK* callback, BYTE* da UINT32 usbd_status = USBD_STATUS_SUCCESS; BYTE* OutputBuffer; BYTE* out_data; - int i, offset, success = 0; + UINT32 i; + int offset, success = 0; WLog_DBG(TAG, "urbdrc_process__io_control"); @@ -427,7 +428,7 @@ static int urbdrc_process_query_device_text(URBDRC_CHANNEL_CALLBACK* callback, B static void func_select_all_interface_for_msconfig(IUDEVICE* pdev, MSUSB_CONFIG_DESCRIPTOR* MsConfig) { - int inum; + UINT32 inum; MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces = MsConfig->MsInterfaces; BYTE InterfaceNumber, AlternateSetting; UINT32 NumInterfaces = MsConfig->NumInterfaces; diff --git a/channels/urbdrc/client/libusb/libusb_udevice.c b/channels/urbdrc/client/libusb/libusb_udevice.c index 7a25e13..a8e5444 100644 --- a/channels/urbdrc/client/libusb/libusb_udevice.c +++ b/channels/urbdrc/client/libusb/libusb_udevice.c @@ -171,8 +171,8 @@ static void func_iso_callback(struct libusb_transfer* transfer) BYTE* data = iso_user_data->IsoPacket; int* completed = &iso_user_data->completed; UINT32 offset = 0; - UINT32 index = 0; - UINT32 i, act_len; + INT32 index = 0; + INT32 i, act_len; BYTE* b; *completed = 1; @@ -234,7 +234,7 @@ static const LIBUSB_ENDPOINT_DESCEIPTOR* func_get_ep_desc(LIBUSB_CONFIG_DESCRIPT MSUSB_CONFIG_DESCRIPTOR* MsConfig, UINT32 EndpointAddress) { BYTE alt; - int inum, pnum; + UINT32 inum, pnum; MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces; const LIBUSB_INTERFACE* interface; const LIBUSB_ENDPOINT_DESCEIPTOR* endpoint; @@ -359,7 +359,8 @@ static void func_iso_data_init(ISO_USER_DATA* iso_user_data, UINT32 numPacket, U static int func_config_release_all_interface(LIBUSB_DEVICE_HANDLE* libusb_handle, UINT32 NumInterfaces) { - int i, ret; + UINT32 i; + int ret; for (i = 0; i < NumInterfaces; i++) { @@ -630,7 +631,7 @@ static int udev_get_hub_handle(UDEVICE* pdev, UINT16 bus_number, UINT16 dev_numb } while (p1 != NULL); - if ((p2 - sysfs_path) < (strlen(sysfs_path) - 2)) + if ((p2 - sysfs_path) < (strlen(sysfs_path) - 2U)) { p1 = (char*) sysfs_path; @@ -761,7 +762,7 @@ static MSUSB_CONFIG_DESCRIPTOR* libusb_udev_complete_msconfig_setup(IUDEVICE* id const LIBUSB_INTERFACE_DESCRIPTOR* LibusbAltsetting; const LIBUSB_ENDPOINT_DESCEIPTOR* LibusbEndpoint; BYTE LibusbNumEndpoint; - int inum = 0, pnum = 0, MsOutSize = 0; + UINT32 inum = 0, pnum = 0, MsOutSize = 0; LibusbConfig = pdev->LibusbConfig; if (LibusbConfig->bNumInterfaces != MsConfig->NumInterfaces) @@ -994,7 +995,8 @@ static int libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextType char deviceLocation[25]; BYTE bus_number; BYTE device_address; - int ret = 0, i = 0; + int ret = 0; + size_t i = 0; switch (TextType) { @@ -1005,7 +1007,7 @@ static int libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextType Buffer, *BufferSize); - for (i = 0; i < ret; i++) + for (i = 0; (ret > 0) && (i < (size_t)ret); i++) { Buffer[i] = Buffer[i + 2]; } diff --git a/channels/urbdrc/client/urbdrc_main.c b/channels/urbdrc/client/urbdrc_main.c index 19b78b1..7d18418 100644 --- a/channels/urbdrc/client/urbdrc_main.c +++ b/channels/urbdrc/client/urbdrc_main.c @@ -1153,7 +1153,7 @@ void* urbdrc_new_device_create(void* arg) static UINT urbdrc_process_channel_notification(URBDRC_CHANNEL_CALLBACK* callback, char* pBuffer, UINT32 cbSize) { - int i; + UINT32 i; UINT32 MessageId; UINT32 FunctionId; UINT error = CHANNEL_RC_OK; -- 2.7.4