Silence sign-compare warning in usb_hidapi.c

This commit is contained in:
Stefan Rueger 2023-01-11 18:25:00 +00:00
parent 79dd434d20
commit 246d2d502d
No known key found for this signature in database
GPG Key ID: B0B4F1FD86B1EC55
1 changed files with 4 additions and 1 deletions

View File

@ -272,7 +272,9 @@ static int usbhid_recv(const union filedescriptor *fd, unsigned char *buf, size_
return -1;
rv = i = hid_read_timeout(udev, buf, nbytes, 10000);
if (i != nbytes)
if (i < 0)
pmsg_error("hid_read_timeout(usb, %lu, 10000) failed\n", (unsigned long) nbytes);
else if ((size_t) i != nbytes)
pmsg_error("short read, read only %d out of %lu bytes\n", i, (unsigned long) nbytes);
if (verbose > 4) {
@ -291,6 +293,7 @@ static int usbhid_recv(const union filedescriptor *fd, unsigned char *buf, size_
}
msg_trace2("\n");
}
return rv;
}