airspy: correct gcc6 warnings

This commit is contained in:
Dimitri Stolnikov 2017-02-27 23:01:15 +01:00
parent c6ed80aea7
commit 6a0cac6609
1 changed files with 18 additions and 7 deletions

View File

@ -46,13 +46,18 @@
using namespace boost::assign; using namespace boost::assign;
#define AIRSPY_FORMAT_ERROR(ret, msg) \
boost::str( boost::format(msg " (%1%) %2%") \
% ret % airspy_error_name((enum airspy_error)ret) )
#define AIRSPY_THROW_ON_ERROR(ret, msg) \ #define AIRSPY_THROW_ON_ERROR(ret, msg) \
if ( ret != AIRSPY_SUCCESS ) \ if ( ret != AIRSPY_SUCCESS ) \
throw std::runtime_error( boost::str( boost::format(msg " (%d) %s") \ { \
% ret % airspy_error_name((enum airspy_error)ret) ) ); throw std::runtime_error( AIRSPY_FORMAT_ERROR(ret, msg) ); \
}
#define AIRSPY_FUNC_STR(func, arg) \ #define AIRSPY_FUNC_STR(func, arg) \
boost::str(boost::format(func "(%d)") % arg) + " has failed" boost::str(boost::format(func "(%1%)") % arg) + " has failed"
airspy_source_c_sptr make_airspy_source_c (const std::string & args) airspy_source_c_sptr make_airspy_source_c (const std::string & args)
{ {
@ -182,11 +187,17 @@ airspy_source_c::~airspy_source_c ()
if ( airspy_is_streaming( _dev ) == AIRSPY_TRUE ) if ( airspy_is_streaming( _dev ) == AIRSPY_TRUE )
{ {
ret = airspy_stop_rx( _dev ); ret = airspy_stop_rx( _dev );
AIRSPY_THROW_ON_ERROR(ret, "Failed to stop RX streaming") if ( ret != AIRSPY_SUCCESS )
{
std::cerr << AIRSPY_FORMAT_ERROR(ret, "Failed to stop RX streaming") << std::endl;
}
} }
ret = airspy_close( _dev ); ret = airspy_close( _dev );
AIRSPY_THROW_ON_ERROR(ret, "Failed to close AirSpy") if ( ret != AIRSPY_SUCCESS )
{
std::cerr << AIRSPY_FORMAT_ERROR(ret, "Failed to close AirSpy") << std::endl;
}
_dev = NULL; _dev = NULL;
} }
@ -678,7 +689,7 @@ double airspy_source_c::set_bandwidth( double bandwidth, size_t chan )
if (size) if (size)
{ {
std::cout << " Airspy decim:" << decim std::cerr << " Airspy decim:" << decim
<< " kernel size:" << size << std::endl; << " kernel size:" << size << std::endl;
ret = airspy_set_conversion_filter_float32(_dev, kernel, size); ret = airspy_set_conversion_filter_float32(_dev, kernel, size);
AIRSPY_THROW_ON_ERROR(ret, "Failed to set IQ conversion filter") AIRSPY_THROW_ON_ERROR(ret, "Failed to set IQ conversion filter")