From c286032a2a26edcbbd19686032e8d3517db9868e Mon Sep 17 00:00:00 2001 From: Michael Dickens Date: Fri, 24 Jun 2016 17:21:45 -0400 Subject: usb: tweak types for consistency between LIBUSB API calls and internal UHD usage of returned values. --- host/lib/transport/libusb1_base.cpp | 6 +++--- host/lib/transport/libusb1_zero_copy.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'host') diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp index c0c1d6a86..7b9e11da9 100644 --- a/host/lib/transport/libusb1_base.cpp +++ b/host/lib/transport/libusb1_base.cpp @@ -219,12 +219,12 @@ public: ); unsigned char buff[512]; - ssize_t ret = libusb_get_string_descriptor_ascii( - handle->get(), off, buff, sizeof(buff) + int ret = libusb_get_string_descriptor_ascii( + handle->get(), off, buff, int(sizeof(buff)) ); if (ret < 0) return ""; //on error, just return empty string - std::string string_descriptor((char *)buff, ret); + std::string string_descriptor((char *)buff, size_t(ret)); byte_vector_t string_vec(string_descriptor.begin(), string_descriptor.end()); std::string out; BOOST_FOREACH(boost::uint8_t byte, string_vec){ diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index 3f0db74de..c32b96b63 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -133,13 +133,13 @@ public: UHD_INLINE void submit(void) { - _lut->length = (_is_recv)? _frame_size : size(); //always set length + _lut->length = int((_is_recv)? _frame_size : size()); //always set length #ifdef UHD_TXRX_DEBUG_PRINTS result.start_time = boost::get_system_time().time_of_day().total_microseconds(); result.buff_num = num(); result.is_recv = _is_recv; #endif - const int ret = libusb_submit_transfer(_lut); + int ret = libusb_submit_transfer(_lut); if (ret != LIBUSB_SUCCESS) throw uhd::usb_error(ret, str(boost::format( "usb %s submit failed: %s") % _name % libusb_error_name(ret))); @@ -154,7 +154,7 @@ public: throw uhd::io_error(str(boost::format("usb %s transfer status: %d") % _name % libusb_error_name(result.status))); result.completed = 0; - return make(reinterpret_cast(this), _lut->buffer, (_is_recv)? result.actual_length : _frame_size); + return make(reinterpret_cast(this), _lut->buffer, (_is_recv)? size_t(result.actual_length) : _frame_size); } return typename buffer_type::sptr(); } @@ -227,7 +227,7 @@ public: _handle->get(), // dev_handle endpoint, // endpoint static_cast(buff), - sizeof(buff), + int(sizeof(buff)), &transfered, //bytes xfered 10 //timeout ms ); @@ -249,7 +249,7 @@ public: _handle->get(), // dev_handle endpoint, // endpoint static_cast(_buffer_pool->at(i)), // buffer - this->get_frame_size(), // length + int(this->get_frame_size()), // length libusb_transfer_cb_fn(&libusb_async_cb), // callback static_cast(&_mb_pool.back()->result), // user_data 0 // timeout (ms) -- cgit v1.2.3