Skip to content

Commit

Permalink
hidapi: fix "conversion from 'size_t' to 'int', possible loss of data' (
Browse files Browse the repository at this point in the history
#681)

This warning shows up when building with libusb support using MSVC.
Upstreaming of libsdl-org/SDL@1664ac4
  • Loading branch information
madebr authored Aug 21, 2024
1 parent d101e5c commit c3c79a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libusb/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ static void *read_thread(void *param)
dev->device_handle,
dev->input_endpoint,
buf,
length,
(int)length,
read_callback,
dev,
5000/*timeout*/);
Expand Down Expand Up @@ -1431,7 +1431,7 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
res = libusb_interrupt_transfer(dev->device_handle,
dev->output_endpoint,
(unsigned char*)data,
length,
(int)length,
&actual_length, 1000);

if (res < 0)
Expand All @@ -1456,7 +1456,7 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length)
dev->input_reports = rpt->next;
free(rpt->data);
free(rpt);
return len;
return (int)len;
}

static void cleanup_mutex(void *param)
Expand Down Expand Up @@ -1589,7 +1589,7 @@ int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char
if (skipped_report_id)
length++;

return length;
return (int)length;
}

int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
Expand Down

0 comments on commit c3c79a7

Please sign in to comment.