diff options
author | Luca Longinotti <l@longi.li> | 2013-06-17 09:22:23 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-06-19 11:17:59 +0200 |
commit | 88828bd7c8323cefe307e4e9856daf7e9812d4d5 (patch) | |
tree | 6bcbb7a15c02f52068368633b2f8911abc7a52af /libusb/libusb.h | |
parent | 02281fda6ee5ed7456f381105d159e15dc1b6da6 (diff) | |
download | libusb-88828bd7c8323cefe307e4e9856daf7e9812d4d5.tar.gz |
Fix several -Wconversion warnings from GCC inside the static inline functions.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'libusb/libusb.h')
-rw-r--r-- | libusb/libusb.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h index d7cc40f..5e1c23c 100644 --- a/libusb/libusb.h +++ b/libusb/libusb.h @@ -164,8 +164,8 @@ static inline uint16_t libusb_cpu_to_le16(const uint16_t x) uint8_t b8[2]; uint16_t b16; } _tmp; - _tmp.b8[1] = x >> 8; - _tmp.b8[0] = x & 0xff; + _tmp.b8[1] = (uint8_t) (x >> 8); + _tmp.b8[0] = (uint8_t) (x & 0xff); return _tmp.b16; } @@ -1509,8 +1509,8 @@ static inline void libusb_fill_control_transfer( transfer->timeout = timeout; transfer->buffer = buffer; if (setup) - transfer->length = LIBUSB_CONTROL_SETUP_SIZE - + libusb_le16_to_cpu(setup->wLength); + transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE + + libusb_le16_to_cpu(setup->wLength)); transfer->user_data = user_data; transfer->callback = callback; } @@ -1645,7 +1645,7 @@ static inline unsigned char *libusb_get_iso_packet_buffer( * signed to avoid compiler warnings. FIXME for libusb-2. */ if (packet > INT_MAX) return NULL; - _packet = packet; + _packet = (int) packet; if (_packet >= transfer->num_iso_packets) return NULL; @@ -1685,12 +1685,12 @@ static inline unsigned char *libusb_get_iso_packet_buffer_simple( * signed to avoid compiler warnings. FIXME for libusb-2. */ if (packet > INT_MAX) return NULL; - _packet = packet; + _packet = (int) packet; if (_packet >= transfer->num_iso_packets) return NULL; - return transfer->buffer + (transfer->iso_packet_desc[0].length * _packet); + return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet); } /* sync I/O */ @@ -1723,8 +1723,8 @@ static inline int libusb_get_descriptor(libusb_device_handle *dev, uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length) { return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN, - LIBUSB_REQUEST_GET_DESCRIPTOR, (desc_type << 8) | desc_index, 0, data, - (uint16_t) length, 1000); + LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index), + 0, data, (uint16_t) length, 1000); } /** \ingroup desc |