descriptor: Fix clang -Wimplicit-int-conversion warnings
Some checks are pending
linux / build (push) Waiting to run
macOS / build (push) Waiting to run
MSYS2 build / build (push) Waiting to run
MSYS2 clang32 build / build (push) Waiting to run
MSYS2 clang64 build / build (push) Waiting to run

For the 16-bit case especially, the result of the `or` is implicitly
promoted to `int`, then when returned was warning:

warning: implicit conversion loses integer precision: 'int' to 'uint16_t' (aka 'unsigned short') [-Wimplicit-int-conversion]

Add more casts to shut it up.

Closes #1541
This commit is contained in:
Sean McBride 2024-07-29 10:55:01 -04:00 committed by Tormod Volden
parent a3199696e2
commit 8776b8021a
2 changed files with 7 additions and 7 deletions

View file

@ -32,16 +32,16 @@
static inline uint16_t ReadLittleEndian16(const uint8_t p[2])
{
return (uint16_t)p[1] << 8 |
(uint16_t)p[0];
return (uint16_t)((uint16_t)p[1] << 8 |
(uint16_t)p[0]);
}
static inline uint32_t ReadLittleEndian32(const uint8_t p[4])
{
return (uint32_t)p[3] << 24 |
(uint32_t)p[2] << 16 |
(uint32_t)p[1] << 8 |
(uint32_t)p[0];
return (uint32_t)((uint32_t)p[3] << 24 |
(uint32_t)p[2] << 16 |
(uint32_t)p[1] << 8 |
(uint32_t)p[0]);
}
static void clear_endpoint(struct libusb_endpoint_descriptor *endpoint)

View file

@ -1 +1 @@
#define LIBUSB_NANO 11934
#define LIBUSB_NANO 11935