Skip to content

Commit c3c79a7

Browse files
authored
hidapi: fix "conversion from 'size_t' to 'int', possible loss of data' (#681)
This warning shows up when building with libusb support using MSVC. Upstreaming of libsdl-org/SDL@1664ac4
1 parent d101e5c commit c3c79a7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

libusb/hid.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ static void *read_thread(void *param)
10301030
dev->device_handle,
10311031
dev->input_endpoint,
10321032
buf,
1033-
length,
1033+
(int)length,
10341034
read_callback,
10351035
dev,
10361036
5000/*timeout*/);
@@ -1431,7 +1431,7 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
14311431
res = libusb_interrupt_transfer(dev->device_handle,
14321432
dev->output_endpoint,
14331433
(unsigned char*)data,
1434-
length,
1434+
(int)length,
14351435
&actual_length, 1000);
14361436

14371437
if (res < 0)
@@ -1456,7 +1456,7 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length)
14561456
dev->input_reports = rpt->next;
14571457
free(rpt->data);
14581458
free(rpt);
1459-
return len;
1459+
return (int)len;
14601460
}
14611461

14621462
static void cleanup_mutex(void *param)
@@ -1589,7 +1589,7 @@ int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char
15891589
if (skipped_report_id)
15901590
length++;
15911591

1592-
return length;
1592+
return (int)length;
15931593
}
15941594

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

0 commit comments

Comments
 (0)