aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-01-08 09:33:36 +0100
committerAaron Rossetto <aaron.rossetto@ni.com>2021-03-04 08:07:26 -0600
commit107a49c0c236940da7d3bd0f57da4bc1e2a34cb4 (patch)
treefdeaad56030a02948377c45838dab97beb7a5c84 /host/utils
parent7d5e48032baa62cbe7467833b9e057900602f4b9 (diff)
downloaduhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.tar.gz
uhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.tar.bz2
uhd-107a49c0c236940da7d3bd0f57da4bc1e2a34cb4.zip
host: Update code base using clang-tidy
The checks from the new clang-tidy file are applied to the source tree using: $ find . -name "*.cpp" | sort -u | xargs \ --max-procs 8 --max-args 1 clang-tidy --format-style=file \ --fix -p /path/to/compile_commands.json
Diffstat (limited to 'host/utils')
-rw-r--r--host/utils/b2xx_fx3_utils.cpp7
-rw-r--r--host/utils/fx2_init_eeprom.cpp2
-rw-r--r--host/utils/latency/lib/Responder.cpp4
-rw-r--r--host/utils/octoclock_burn_eeprom.cpp2
-rw-r--r--host/utils/uhd_image_loader.cpp6
-rw-r--r--host/utils/uhd_usrp_probe.cpp6
-rw-r--r--host/utils/usrp_burn_mb_eeprom.cpp2
7 files changed, 14 insertions, 15 deletions
diff --git a/host/utils/b2xx_fx3_utils.cpp b/host/utils/b2xx_fx3_utils.cpp
index b75ff6960..65c4e52ca 100644
--- a/host/utils/b2xx_fx3_utils.cpp
+++ b/host/utils/b2xx_fx3_utils.cpp
@@ -173,7 +173,7 @@ uhd::transport::usb_device_handle::sptr open_device(
std::vector<uhd::transport::usb_device_handle::vid_pid_pair_t> vid_pid_pair_list(
1, uhd::transport::usb_device_handle::vid_pid_pair_t(vid, pid));
handles = uhd::transport::usb_device_handle::get_device_list(vid_pid_pair_list);
- if (handles.size() == 0) {
+ if (handles.empty()) {
if (user_supplied) {
std::cerr << (boost::format("Failed to open device with VID 0x%04x and "
"PID 0x%04x - trying other known VID/PIDs")
@@ -183,15 +183,14 @@ uhd::transport::usb_device_handle::sptr open_device(
}
// try known VID/PIDs next
- for (size_t i = 0; handles.size() == 0 && i < known_vid_pid_vector.size();
- i++) {
+ for (size_t i = 0; handles.empty() && i < known_vid_pid_vector.size(); i++) {
vp = known_vid_pid_vector[i];
handles =
uhd::transport::usb_device_handle::get_device_list(vp.vid, vp.pid);
}
}
- if (handles.size() > 0) {
+ if (!handles.empty()) {
handle = handles[0];
std::cout << (boost::format("Device opened (VID=0x%04x,PID=0x%04x)") % vp.vid
% vp.pid)
diff --git a/host/utils/fx2_init_eeprom.cpp b/host/utils/fx2_init_eeprom.cpp
index e375b27f5..3ddc62c41 100644
--- a/host/utils/fx2_init_eeprom.cpp
+++ b/host/utils/fx2_init_eeprom.cpp
@@ -130,7 +130,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
uhd::device_addrs_t found_addrs = uhd::device::find(device_addr, uhd::device::USRP);
- if (found_addrs.size() == 0) {
+ if (found_addrs.empty()) {
std::cerr << "No USRP devices found" << std::endl;
return EXIT_FAILURE;
}
diff --git a/host/utils/latency/lib/Responder.cpp b/host/utils/latency/lib/Responder.cpp
index c2f224d00..65c3e2941 100644
--- a/host/utils/latency/lib/Responder.cpp
+++ b/host/utils/latency/lib/Responder.cpp
@@ -664,7 +664,7 @@ bool Responder::handle_interactive_control()
// print updated interactive control value
void Responder::print_interactive_msg(std::string msg)
{
- if (msg != "") {
+ if (!msg.empty()) {
// move cursor back to beginning of line
int y, x;
getyx(_window, y, x);
@@ -1107,7 +1107,7 @@ void Responder::write_log_file()
logs << boost::format("device=%s") % _usrp->get_mboard_name() << endl;
logs << boost::format("device_args=%s") % _opt.device_args << endl;
logs << boost::format("type=%s") % hw_info["type"] << endl;
- if (hw_info.size() > 0) {
+ if (!hw_info.empty()) {
logs << boost::format("usrp_addr=%s") % hw_info["usrp_addr"] << endl;
logs << boost::format("usrp_name=%s") % hw_info["name"] << endl;
logs << boost::format("serial=%s") % hw_info["serial"] << endl;
diff --git a/host/utils/octoclock_burn_eeprom.cpp b/host/utils/octoclock_burn_eeprom.cpp
index 6221c4e83..1e8341e13 100644
--- a/host/utils/octoclock_burn_eeprom.cpp
+++ b/host/utils/octoclock_burn_eeprom.cpp
@@ -82,7 +82,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
if (!vm.count("read-all")) {
std::cout << std::endl;
for (size_t i = 0; i < vals_vec.size(); i++) {
- if (vals_vec[i] != "") {
+ if (!vals_vec[i].empty()) {
oc_eeprom[keys_vec[i]] = vals_vec[i];
std::cout << boost::format("Setting EEPROM [\"%s\"] to \"%s\"...")
% keys_vec[i] % vals_vec[i]
diff --git a/host/utils/uhd_image_loader.cpp b/host/utils/uhd_image_loader.cpp
index 87dc22b5c..36936fda1 100644
--- a/host/utils/uhd_image_loader.cpp
+++ b/host/utils/uhd_image_loader.cpp
@@ -95,7 +95,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
}
// Clean up paths, if given
- if (image_loader_args.firmware_path != "") {
+ if (!image_loader_args.firmware_path.empty()) {
#ifndef UHD_PLATFORM_WIN32
if (image_loader_args.firmware_path.find("~") == 0) {
image_loader_args.firmware_path.replace(0, 1, getenv("HOME"));
@@ -104,7 +104,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
image_loader_args.firmware_path =
fs::absolute(image_loader_args.firmware_path).string();
}
- if (image_loader_args.fpga_path != "") {
+ if (!image_loader_args.fpga_path.empty()) {
#ifndef UHD_PLATFORM_WIN32
if (image_loader_args.fpga_path.find("~") == 0) {
image_loader_args.fpga_path.replace(0, 1, getenv("HOME"));
@@ -112,7 +112,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
#endif /* UHD_PLATFORM_WIN32 */
image_loader_args.fpga_path = fs::absolute(image_loader_args.fpga_path).string();
}
- if (image_loader_args.out_path != "") {
+ if (!image_loader_args.out_path.empty()) {
#ifndef UHD_PLATFORM_WIN32
if (image_loader_args.out_path.find("~") == 0) {
image_loader_args.out_path.replace(0, 1, getenv("HOME"));
diff --git a/host/utils/uhd_usrp_probe.cpp b/host/utils/uhd_usrp_probe.cpp
index 24b82543c..50eabc55b 100644
--- a/host/utils/uhd_usrp_probe.cpp
+++ b/host/utils/uhd_usrp_probe.cpp
@@ -39,7 +39,7 @@ static std::string make_border(const std::string& text)
boost::split(lines, text, boost::is_any_of("\n"));
while (lines.back().empty())
lines.pop_back(); // strip trailing newlines
- if (lines.size())
+ if (!lines.empty())
lines[0] = " " + lines[0]; // indent the title line
for (const std::string& line : lines) {
ss << boost::format("| %s") % line << std::endl;
@@ -99,7 +99,7 @@ static std::string get_frontend_pp_string(
<< std::endl;
std::vector<std::string> gain_names = tree->list(path / "gains");
- if (gain_names.size() == 0)
+ if (gain_names.empty())
ss << "Gain Elements: None" << std::endl;
for (const std::string& name : gain_names) {
meta_range_t gain_range =
@@ -139,7 +139,7 @@ static std::string get_codec_pp_string(
ss << boost::format("Name: %s") % (tree->access<std::string>(path / "name").get())
<< std::endl;
std::vector<std::string> gain_names = tree->list(path / "gains");
- if (gain_names.size() == 0)
+ if (gain_names.empty())
ss << "Gain Elements: None" << std::endl;
for (const std::string& name : gain_names) {
meta_range_t gain_range =
diff --git a/host/utils/usrp_burn_mb_eeprom.cpp b/host/utils/usrp_burn_mb_eeprom.cpp
index 18e8b367b..c0ff18309 100644
--- a/host/utils/usrp_burn_mb_eeprom.cpp
+++ b/host/utils/usrp_burn_mb_eeprom.cpp
@@ -85,7 +85,7 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
if (not vals_vec.empty()) {
mb_eeprom = uhd::usrp::mboard_eeprom_t();
for (size_t i = 0; i < vals_vec.size(); i++) {
- if (vals_vec[i] != "") {
+ if (!vals_vec[i].empty()) {
mb_eeprom[keys_vec[i]] = vals_vec[i];
std::cout << boost::format("Setting EEPROM [\"%s\"] to \"%s\"...")
% keys_vec[i] % vals_vec[i]