1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

windows: Fix a warning on size_t to USHORT conversion.

Building with MSVC gave:
warning C4267: '=': conversion from 'size_t' to 'USHORT', possible loss of data

The value here is known to be safe for the sizes involved. Add an
explicit cast to suppress the warning.
This commit is contained in:
Martin Ling 2020-01-24 05:06:55 +00:00 committed by Uwe Hermann
parent 41fc921ce4
commit 60fc49ceab

View File

@ -143,7 +143,7 @@ static char *get_string_descriptor(HANDLE hub_device, ULONG connection_index,
desc_req->SetupPacket.wValue = (USB_STRING_DESCRIPTOR_TYPE << 8) desc_req->SetupPacket.wValue = (USB_STRING_DESCRIPTOR_TYPE << 8)
| descriptor_index; | descriptor_index;
desc_req->SetupPacket.wIndex = 0; desc_req->SetupPacket.wIndex = 0;
desc_req->SetupPacket.wLength = size - sizeof(*desc_req); desc_req->SetupPacket.wLength = (USHORT) (size - sizeof(*desc_req));
if (!DeviceIoControl(hub_device, if (!DeviceIoControl(hub_device,
IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION,