aboutsummaryrefslogtreecommitdiffstats
path: root/utils/rds-ctl/rds-ctl.cpp
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-07-26 20:14:50 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-08-03 12:23:02 +0200
commitb14f60cfcc37a61650e78c4f39143ec61b55a9b4 (patch)
tree49016e471a908bf5548a323cd25a2df7651dd74b /utils/rds-ctl/rds-ctl.cpp
parentc7f03287bbd64c168975e7ff3192e6fd3b507686 (diff)
convert to range based loops
Found with modernize-loop-convert Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/rds-ctl/rds-ctl.cpp')
-rw-r--r--utils/rds-ctl/rds-ctl.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 73fc7e3c..e69a498d 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -306,9 +306,8 @@ static void print_devices(dev_vec files)
std::string bus_info;
struct v4l2_capability vcap;
- for (dev_vec::iterator iter = files.begin();
- iter != files.end(); ++iter) {
- fd = open(iter->c_str(), O_RDWR);
+ for (const auto &file : files) {
+ fd = open(file.c_str(), O_RDWR);
memset(&vcap, 0, sizeof(vcap));
if (fd < 0)
continue;
@@ -318,12 +317,11 @@ static void print_devices(dev_vec files)
if (cards[bus_info].empty())
cards[bus_info] += std::string(reinterpret_cast<char *>(vcap.card))
+ " (" + bus_info + "):\n";
- cards[bus_info] += "\t" + (*iter);
+ cards[bus_info] += "\t" + file;
cards[bus_info] += "\n";
}
- for (dev_map::iterator iter = cards.begin();
- iter != cards.end(); ++iter) {
- printf("%s\n", iter->second.c_str());
+ for (const auto &card : cards) {
+ printf("%s\n", card.second.c_str());
}
}
static dev_vec list_devices()

Privacy Policy