From 8ea24c306fdf2a141433e396307e92a227416ba5 Mon Sep 17 00:00:00 2001 From: CNLohr Date: Fri, 17 Mar 2017 01:08:06 -0400 Subject: Fix Warnings --- windows/hid.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'windows/hid.c') diff --git a/windows/hid.c b/windows/hid.c index 8f80071..6c379b5 100644 --- a/windows/hid.c +++ b/windows/hid.c @@ -687,7 +687,7 @@ int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char * length = dev->output_report_length; } - res = WriteFile(dev->device_handle, buf, length, NULL, &ol); + res = WriteFile(dev->device_handle, buf, (DWORD)length, NULL, &ol); if (!res) { if (GetLastError() != ERROR_IO_PENDING) { @@ -730,7 +730,7 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char dev->read_pending = TRUE; memset(dev->read_buf, 0, dev->input_report_length); ResetEvent(ev); - res = ReadFile(dev->device_handle, dev->read_buf, dev->input_report_length, &bytes_read, &dev->ol); + res = ReadFile(dev->device_handle, dev->read_buf, (DWORD)dev->input_report_length, &bytes_read, &dev->ol); if (!res) { if (GetLastError() != ERROR_IO_PENDING) { @@ -784,7 +784,7 @@ end_of_function: return -1; } - return copy_len; + return (int)copy_len; } int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length) @@ -800,13 +800,13 @@ int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *dev, int nonbloc int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length) { - BOOL res = HidD_SetFeature(dev->device_handle, (PVOID)data, length); + BOOL res = HidD_SetFeature(dev->device_handle, (PVOID)data, (ULONG)length); if (!res) { register_error(dev, "HidD_SetFeature"); return -1; } - return length; + return (int)length; } @@ -828,8 +828,8 @@ int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned res = DeviceIoControl(dev->device_handle, IOCTL_HID_GET_FEATURE, - data, length, - data, length, + data, (DWORD)length, + data, (DWORD)length, &bytes_returned, &ol); if (!res) { @@ -870,7 +870,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_manufacturer_string(hid_device *dev { BOOL res; - res = HidD_GetManufacturerString(dev->device_handle, string, sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS)); + res = HidD_GetManufacturerString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS))); if (!res) { register_error(dev, "HidD_GetManufacturerString"); return -1; @@ -883,7 +883,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_product_string(hid_device *dev, wch { BOOL res; - res = HidD_GetProductString(dev->device_handle, string, sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS)); + res = HidD_GetProductString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS))); if (!res) { register_error(dev, "HidD_GetProductString"); return -1; @@ -896,7 +896,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_serial_number_string(hid_device *de { BOOL res; - res = HidD_GetSerialNumberString(dev->device_handle, string, sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS)); + res = HidD_GetSerialNumberString(dev->device_handle, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS))); if (!res) { register_error(dev, "HidD_GetSerialNumberString"); return -1; @@ -909,7 +909,7 @@ int HID_API_EXPORT_CALL HID_API_CALL hid_get_indexed_string(hid_device *dev, int { BOOL res; - res = HidD_GetIndexedString(dev->device_handle, string_index, string, sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS)); + res = HidD_GetIndexedString(dev->device_handle, string_index, string, (ULONG)(sizeof(wchar_t) * MIN(maxlen, MAX_STRING_WCHARS))); if (!res) { register_error(dev, "HidD_GetIndexedString"); return -1; -- cgit v1.2.3