diff --git a/windows/hid.c b/windows/hid.c index 799b355..2d736b4 100755 --- a/windows/hid.c +++ b/windows/hid.c @@ -654,7 +654,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) { @@ -697,7 +697,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) { @@ -751,7 +751,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) @@ -767,13 +767,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, (DWORD) length); if (!res) { register_error(dev, "HidD_SetFeature"); return -1; } - return length; + return (int) length; } @@ -795,8 +795,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) { @@ -844,8 +844,8 @@ int HID_API_EXPORT HID_API_CALL hid_get_input_report(hid_device *dev, unsigned c res = DeviceIoControl(dev->device_handle, IOCTL_HID_GET_INPUT_REPORT, - data, length, - data, length, + data, (DWORD) length, + data, (DWORD) length, &bytes_returned, &ol); if (!res) { @@ -886,7 +886,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, sizeof(wchar_t) * (DWORD) MIN(maxlen, MAX_STRING_WCHARS)); if (!res) { register_error(dev, "HidD_GetManufacturerString"); return -1; @@ -899,7 +899,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, sizeof(wchar_t) * (DWORD) MIN(maxlen, MAX_STRING_WCHARS)); if (!res) { register_error(dev, "HidD_GetProductString"); return -1; @@ -912,7 +912,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, sizeof(wchar_t) * (DWORD) MIN(maxlen, MAX_STRING_WCHARS)); if (!res) { register_error(dev, "HidD_GetSerialNumberString"); return -1; @@ -925,7 +925,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, sizeof(wchar_t) * (DWORD) MIN(maxlen, MAX_STRING_WCHARS)); if (!res) { register_error(dev, "HidD_GetIndexedString"); return -1;