mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-29 14:37:39 +00:00
clang-tidy: apply readability-string-compare fix (see https://clang.llvm.org/extra/clang-tidy/checks/readability-string-compare.html)
This commit is contained in:
@@ -59,8 +59,8 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s;
|
||||
if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s != "-") filename_ = FLAGS_s;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
@@ -74,28 +74,28 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
|
||||
bool is_complex = false;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
}
|
||||
else if (item_type_.compare("float") == 0)
|
||||
else if (item_type_ == "float")
|
||||
{
|
||||
item_size_ = sizeof(float);
|
||||
}
|
||||
else if (item_type_.compare("short") == 0)
|
||||
else if (item_type_ == "short")
|
||||
{
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
else if (item_type_.compare("ishort") == 0)
|
||||
else if (item_type_ == "ishort")
|
||||
{
|
||||
item_size_ = sizeof(int16_t);
|
||||
is_complex = true;
|
||||
}
|
||||
else if (item_type_.compare("byte") == 0)
|
||||
else if (item_type_ == "byte")
|
||||
{
|
||||
item_size_ = sizeof(int8_t);
|
||||
}
|
||||
else if (item_type_.compare("ibyte") == 0)
|
||||
else if (item_type_ == "ibyte")
|
||||
{
|
||||
item_size_ = sizeof(int8_t);
|
||||
is_complex = true;
|
||||
@@ -135,7 +135,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
if (filename_.compare(default_filename) == 0)
|
||||
if (filename_ == default_filename)
|
||||
{
|
||||
std::cerr
|
||||
<< "The configuration file has not been found."
|
||||
|
||||
@@ -51,7 +51,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
|
||||
samples_ = configuration->property(role + ".samples", 0);
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
labsat23_source_ = labsat23_make_source(filename_.c_str(), channel_selector);
|
||||
|
||||
@@ -57,8 +57,8 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s;
|
||||
if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s != "-") filename_ = FLAGS_s;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
@@ -66,7 +66,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
|
||||
|
||||
if (item_type_.compare("byte") == 0)
|
||||
if (item_type_ == "byte")
|
||||
{
|
||||
item_size_ = sizeof(char);
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
port_ = configuration->property(role + ".port", default_port);
|
||||
flip_iq_ = configuration->property(role + ".flip_iq", false);
|
||||
|
||||
if (item_type_.compare("short") == 0)
|
||||
if (item_type_ == "short")
|
||||
{
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
else if (item_type_.compare("gr_complex") == 0)
|
||||
else if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
// 1. Make the gr block
|
||||
|
||||
@@ -56,8 +56,8 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s;
|
||||
if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s != "-") filename_ = FLAGS_s;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
@@ -65,7 +65,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
|
||||
|
||||
if (item_type_.compare("int") == 0)
|
||||
if (item_type_ == "int")
|
||||
{
|
||||
item_size_ = sizeof(int);
|
||||
}
|
||||
|
||||
@@ -57,13 +57,13 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
// available transports on the system (ethernet, usb...).
|
||||
// To narrow down the discovery process to a particular device,
|
||||
// specify a transport key/value pair specific to your device.
|
||||
if (empty.compare(device_address_) != 0) // if not empty
|
||||
if (empty != device_address_) // if not empty
|
||||
{
|
||||
dev_addr["addr"] = device_address_;
|
||||
}
|
||||
//filter the device by serial number if required (useful for USB devices)
|
||||
std::string device_serial = configuration->property(role + ".device_serial", empty);
|
||||
if (empty.compare(device_serial) != 0) // if not empty
|
||||
if (empty != device_serial) // if not empty
|
||||
{
|
||||
dev_addr["serial"] = device_serial;
|
||||
}
|
||||
@@ -111,17 +111,17 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
// fc32: Complex floating point (32-bit floats) range [-1.0, +1.0].
|
||||
// sc16: Complex signed integer (16-bit integers) range [-32768, +32767].
|
||||
// sc8: Complex signed integer (8-bit integers) range [-128, 127].
|
||||
if (item_type_.compare("cbyte") == 0)
|
||||
if (item_type_ == "cbyte")
|
||||
{
|
||||
item_size_ = sizeof(lv_8sc_t);
|
||||
uhd_stream_args_ = uhd::stream_args_t("sc8");
|
||||
}
|
||||
else if (item_type_.compare("cshort") == 0)
|
||||
else if (item_type_ == "cshort")
|
||||
{
|
||||
item_size_ = sizeof(lv_16sc_t);
|
||||
uhd_stream_args_ = uhd::stream_args_t("sc16");
|
||||
}
|
||||
else if (item_type_.compare("gr_complex") == 0)
|
||||
else if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
uhd_stream_args_ = uhd::stream_args_t("fc32");
|
||||
|
||||
Reference in New Issue
Block a user