From 246d2d502d5b00918f31ced7fa64de873bdc280a Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Wed, 11 Jan 2023 18:25:00 +0000 Subject: [PATCH] Silence sign-compare warning in usb_hidapi.c --- src/usb_hidapi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/usb_hidapi.c b/src/usb_hidapi.c index 4a08c1f5..7dd78314 100644 --- a/src/usb_hidapi.c +++ b/src/usb_hidapi.c @@ -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; }