From 88828bd7c8323cefe307e4e9856daf7e9812d4d5 Mon Sep 17 00:00:00 2001 From: Luca Longinotti Date: Mon, 17 Jun 2013 09:22:23 +0200 Subject: Fix several -Wconversion warnings from GCC inside the static inline functions. Signed-off-by: Hans de Goede --- libusb/libusb.h | 18 +++++++++--------- libusb/version_nano.h | 2 +- 2 files changed, 10 insertions(+), 10 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 diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 4d18db8..1a7fc02 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10745 +#define LIBUSB_NANO 10746 -- cgit v1.2.1