From 69ec75a0b4d2a7fbab0dd456e7190b5c644880f2 Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Mon, 7 Dec 2015 20:27:02 +0100 Subject: [PATCH] hackrf: since devicecount is signed, make comparisons signed as well --- lib/hackrf/hackrf_sink_c.cc | 2 +- lib/hackrf/hackrf_source_c.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc index 7aa864d..e81ae34 100644 --- a/lib/hackrf/hackrf_sink_c.cc +++ b/lib/hackrf/hackrf_sink_c.cc @@ -489,7 +489,7 @@ std::vector hackrf_sink_c::get_devices() #ifdef LIBHACKRF_HAVE_DEVICE_LIST hackrf_device_list_t *list = hackrf_device_list(); - for (unsigned int i = 0; i < list->devicecount; i++) { + for (int i = 0; i < list->devicecount; i++) { label = "HackRF "; label += hackrf_usb_board_id_name( list->usb_board_ids[i] ); diff --git a/lib/hackrf/hackrf_source_c.cc b/lib/hackrf/hackrf_source_c.cc index 81ddad6..79a8c71 100644 --- a/lib/hackrf/hackrf_source_c.cc +++ b/lib/hackrf/hackrf_source_c.cc @@ -151,14 +151,14 @@ hackrf_source_c::hackrf_source_c (const std::string &args) if (hackrf_serial.length() > 1) { ret = hackrf_open_by_serial( hackrf_serial.c_str(), &_dev ); } else { - unsigned int dev_index = 0; + int dev_index = 0; try { - dev_index = boost::lexical_cast< unsigned int >( hackrf_serial ); + dev_index = boost::lexical_cast< int >( hackrf_serial ); } catch ( std::exception &ex ) { throw std::runtime_error( "Failed to use '" + hackrf_serial + "' as HackRF device index number: " + ex.what()); } - + hackrf_device_list_t *list = hackrf_device_list(); if (dev_index < list->devicecount) { ret = hackrf_device_list_open(list, dev_index, &_dev); @@ -404,7 +404,7 @@ std::vector hackrf_source_c::get_devices() #ifdef LIBHACKRF_HAVE_DEVICE_LIST hackrf_device_list_t *list = hackrf_device_list(); - for (unsigned int i = 0; i < list->devicecount; i++) { + for (int i = 0; i < list->devicecount; i++) { label = "HackRF "; label += hackrf_usb_board_id_name( list->usb_board_ids[i] );