mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 03:48:14 +00:00
hidapi: fix 'conversion from 'size_t' to 'int', possible loss of data' of libusb functions
This commit is contained in:

committed by
Anonymous Maarten

parent
d1eab18de2
commit
1664ac4fcb
@@ -1171,7 +1171,7 @@ static void *read_thread(void *param)
|
|||||||
dev->device_handle,
|
dev->device_handle,
|
||||||
dev->input_endpoint,
|
dev->input_endpoint,
|
||||||
buf,
|
buf,
|
||||||
length,
|
(int) length,
|
||||||
read_callback,
|
read_callback,
|
||||||
dev,
|
dev,
|
||||||
5000/*timeout*/);
|
5000/*timeout*/);
|
||||||
@@ -1598,7 +1598,7 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
|
|||||||
if (skipped_report_id)
|
if (skipped_report_id)
|
||||||
length++;
|
length++;
|
||||||
|
|
||||||
return length;
|
return (int) length;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Use the interrupt out endpoint */
|
/* Use the interrupt out endpoint */
|
||||||
@@ -1606,7 +1606,7 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
|
|||||||
res = libusb_interrupt_transfer(dev->device_handle,
|
res = libusb_interrupt_transfer(dev->device_handle,
|
||||||
dev->output_endpoint,
|
dev->output_endpoint,
|
||||||
(unsigned char*)data,
|
(unsigned char*)data,
|
||||||
length,
|
(int) length,
|
||||||
&actual_length, 1000);
|
&actual_length, 1000);
|
||||||
|
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
@@ -1632,7 +1632,7 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length)
|
|||||||
dev->input_reports = rpt->next;
|
dev->input_reports = rpt->next;
|
||||||
free(rpt->data);
|
free(rpt->data);
|
||||||
free(rpt);
|
free(rpt);
|
||||||
return len;
|
return (int) len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanup_mutex(void *param)
|
static void cleanup_mutex(void *param)
|
||||||
@@ -1765,7 +1765,7 @@ int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char
|
|||||||
if (skipped_report_id)
|
if (skipped_report_id)
|
||||||
length++;
|
length++;
|
||||||
|
|
||||||
return length;
|
return (int) length;
|
||||||
}
|
}
|
||||||
|
|
||||||
int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
|
int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
|
||||||
|
Reference in New Issue
Block a user