mirror of
https://github.com/libusb/libusb
synced 2024-11-21 06:26:10 -07:00
descriptor: Fix clang -Wimplicit-int-conversion warnings
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:
parent
a3199696e2
commit
8776b8021a
2 changed files with 7 additions and 7 deletions
|
@ -32,16 +32,16 @@
|
||||||
|
|
||||||
static inline uint16_t ReadLittleEndian16(const uint8_t p[2])
|
static inline uint16_t ReadLittleEndian16(const uint8_t p[2])
|
||||||
{
|
{
|
||||||
return (uint16_t)p[1] << 8 |
|
return (uint16_t)((uint16_t)p[1] << 8 |
|
||||||
(uint16_t)p[0];
|
(uint16_t)p[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t ReadLittleEndian32(const uint8_t p[4])
|
static inline uint32_t ReadLittleEndian32(const uint8_t p[4])
|
||||||
{
|
{
|
||||||
return (uint32_t)p[3] << 24 |
|
return (uint32_t)((uint32_t)p[3] << 24 |
|
||||||
(uint32_t)p[2] << 16 |
|
(uint32_t)p[2] << 16 |
|
||||||
(uint32_t)p[1] << 8 |
|
(uint32_t)p[1] << 8 |
|
||||||
(uint32_t)p[0];
|
(uint32_t)p[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_endpoint(struct libusb_endpoint_descriptor *endpoint)
|
static void clear_endpoint(struct libusb_endpoint_descriptor *endpoint)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define LIBUSB_NANO 11934
|
#define LIBUSB_NANO 11935
|
||||||
|
|
Loading…
Reference in a new issue