* [PATCH 2/8] [clang-tidy] convert to range based loops
2020-07-27 3:14 [PATCH 0/8] v4l-utils: C++11 modernization Rosen Penev
2020-07-27 3:14 ` [PATCH 1/8] fix GCC enum warning Rosen Penev
@ 2020-07-27 3:14 ` Rosen Penev
2020-07-27 3:14 ` [PATCH 3/8] [clang-tidy] use auto Rosen Penev
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Rosen Penev @ 2020-07-27 3:14 UTC (permalink / raw)
To: linux-media
Found with modernize-loop-convert
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
utils/cec-compliance/cec-test.cpp | 57 ++++++------
utils/cec-ctl/cec-ctl.cpp | 28 +++---
utils/cec-follower/cec-follower.cpp | 4 +-
utils/cec-follower/cec-processing.cpp | 12 +--
utils/libcecutil/cec-info.cpp | 24 +++--
utils/libmedia_dev/get_media_devices.c | 6 +-
utils/rds-ctl/rds-ctl.cpp | 12 ++-
utils/v4l2-compliance/v4l2-compliance.cpp | 4 +-
utils/v4l2-compliance/v4l2-test-buffers.cpp | 7 +-
utils/v4l2-compliance/v4l2-test-formats.cpp | 14 +--
utils/v4l2-compliance/v4l2-test-media.cpp | 5 +-
utils/v4l2-ctl/v4l2-ctl-common.cpp | 97 ++++++++++-----------
utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 4 +-
utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 8 +-
utils/v4l2-dbg/v4l2-dbg.cpp | 5 +-
15 files changed, 132 insertions(+), 155 deletions(-)
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index c24c6aa2..2b5265a3 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -922,15 +922,14 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
printf("\t Finished Channel Scan\n");
printf("\t Start Channel Test\n");
- for (std::vector<struct cec_op_tuner_device_info>::iterator iter = info_vec.begin();
- iter != info_vec.end(); iter++) {
+ for (const auto &iter : info_vec) {
cec_msg_init(&msg, me, la);
- log_tuner_service(*iter, "Select ");
- if (iter->is_analog)
- cec_msg_select_analogue_service(&msg, iter->analog.ana_bcast_type,
- iter->analog.ana_freq, iter->analog.bcast_system);
+ log_tuner_service(iter, "Select ");
+ if (iter.is_analog)
+ cec_msg_select_analogue_service(&msg, iter.analog.ana_bcast_type,
+ iter.analog.ana_freq, iter.analog.bcast_system);
else
- cec_msg_select_digital_service(&msg, &iter->digital);
+ cec_msg_select_digital_service(&msg, &iter.digital);
fail_on_test(!transmit(node, &msg));
fail_on_test(cec_msg_status_is_abort(&msg));
cec_msg_init(&msg, me, la);
@@ -939,11 +938,11 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
fail_on_test(timed_out_or_abort(&msg));
memset(&info, 0, sizeof(info));
cec_ops_tuner_device_status(&msg, &info);
- if (memcmp(&info, &(*iter), sizeof(info))) {
+ if (memcmp(&info, &iter, sizeof(info))) {
log_tuner_service(info);
- log_tuner_service(*iter);
+ log_tuner_service(iter);
}
- fail_on_test(memcmp(&info, &(*iter), sizeof(info)));
+ fail_on_test(memcmp(&info, &iter, sizeof(info)));
}
printf("\t Finished Channel Test\n");
@@ -1500,15 +1499,15 @@ void collectTests()
{
std::map<std::string, __u64> mapTestFuncs;
- for (unsigned i = 0; i < num_tests; i++) {
- for (unsigned j = 0; j < tests[i].num_subtests; j++) {
- std::string name = safename(tests[i].subtests[j].name);
- __u64 func = (__u64)tests[i].subtests[j].test_fn;
+ for (const auto &test : tests) {
+ for (unsigned j = 0; j < test.num_subtests; j++) {
+ std::string name = safename(test.subtests[j].name);
+ __u64 func = (__u64)test.subtests[j].test_fn;
if (mapTestFuncs.find(name) != mapTestFuncs.end() &&
mapTestFuncs[name] != func) {
fprintf(stderr, "Duplicate subtest name, but different tests: %s\n",
- tests[i].subtests[j].name);
+ test.subtests[j].name);
std::exit(EXIT_FAILURE);
}
mapTestFuncs[name] = func;
@@ -1520,10 +1519,10 @@ void collectTests()
void listTests()
{
- for (unsigned i = 0; i < num_tests; i++) {
- printf("%s:\n", tests[i].name);
- for (unsigned j = 0; j < tests[i].num_subtests; j++) {
- std::string name = safename(tests[i].subtests[j].name);
+ for (const auto &test : tests) {
+ printf("%s:\n", test.name);
+ for (unsigned j = 0; j < test.num_subtests; j++) {
+ std::string name = safename(test.subtests[j].name);
printf("\t%s\n", name.c_str());
}
@@ -1564,32 +1563,32 @@ void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags,
int ret = 0;
- for (unsigned i = 0; i < num_tests; i++) {
- if ((tests[i].tags & test_tags) != tests[i].tags)
+ for (const auto &test : tests) {
+ if ((test.tags & test_tags) != test.tags)
continue;
- printf("\t%s:\n", tests[i].name);
- for (unsigned j = 0; j < tests[i].num_subtests; j++) {
- const char *name = tests[i].subtests[j].name;
+ printf("\t%s:\n", test.name);
+ for (unsigned j = 0; j < test.num_subtests; j++) {
+ const char *name = test.subtests[j].name;
- if (tests[i].subtests[j].for_cec20 &&
+ if (test.subtests[j].for_cec20 &&
(node->remote[la].cec_version < CEC_OP_CEC_VERSION_2_0 ||
!node->has_cec20))
continue;
- if (tests[i].subtests[j].in_standby) {
+ if (test.subtests[j].in_standby) {
struct cec_log_addrs laddrs = { };
doioctl(node, CEC_ADAP_G_LOG_ADDRS, &laddrs);
if (!laddrs.log_addr_mask)
continue;
}
- node->in_standby = tests[i].subtests[j].in_standby;
+ node->in_standby = test.subtests[j].in_standby;
mode_set_initiator(node);
unsigned old_warnings = warnings;
- ret = tests[i].subtests[j].test_fn(node, me, la, interactive);
+ ret = test.subtests[j].test_fn(node, me, la, interactive);
bool has_warnings = old_warnings < warnings;
- if (!(tests[i].subtests[j].la_mask & (1 << la)) && !ret)
+ if (!(test.subtests[j].la_mask & (1 << la)) && !ret)
ret = OK_UNEXPECTED;
if (mapTests[safename(name)] != DONT_CARE) {
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 47867f87..1fa7ba15 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -706,9 +706,9 @@ static int showTopology(struct node *node)
return 0;
printf("\n\tTopology:\n\n");
- for (unsigned i = 0; i < 16; i++) {
- __u16 pa = pas[i] >> 8;
- __u8 la = pas[i] & 0xf;
+ for (unsigned int i : pas) {
+ __u16 pa = i >> 8;
+ __u8 la = i & 0xf;
if (pa == 0xffff)
break;
@@ -1804,9 +1804,8 @@ static void list_devices()
std::sort(files.begin(), files.end(), sort_on_device_name);
- for (dev_vec::iterator iter = files.begin();
- iter != files.end(); ++iter) {
- int fd = open(iter->c_str(), O_RDWR);
+ for (const auto &file : files) {
+ int fd = open(file.c_str(), O_RDWR);
std::string cec_info;
if (fd < 0)
@@ -1818,14 +1817,13 @@ static void list_devices()
cec_info = std::string(caps.driver) + " (" + caps.name + ")";
if (cards[cec_info].empty())
cards[cec_info] += cec_info + ":\n";
- cards[cec_info] += "\t" + (*iter);
- if (!(links[*iter].empty()))
- cards[cec_info] += " <- " + links[*iter];
+ cards[cec_info] += "\t" + file;
+ if (!(links[file].empty()))
+ cards[cec_info] += " <- " + links[file];
cards[cec_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());
}
}
@@ -2619,10 +2617,8 @@ int main(int argc, char **argv)
if (options[OptNonBlocking])
fcntl(node.fd, F_SETFL, fcntl(node.fd, F_GETFL) | O_NONBLOCK);
- for (msg_vec::iterator iter = msgs.begin(); iter != msgs.end(); ++iter) {
- struct cec_msg msg = *iter;
-
- fflush(stdout);
+ for (auto &msg : msgs) {
+ fflush(stdout);
if (!cec_msg_is_broadcast(&msg) && !options[OptTo]) {
fprintf(stderr, "attempting to send message without --to\n");
std::exit(EXIT_FAILURE);
diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
index b31b51d3..9acdb305 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -500,9 +500,7 @@ int main(int argc, char **argv)
if (laddrs.cec_version >= CEC_OP_CEC_VERSION_2_0) {
bool is_dev_feat = false;
- for (unsigned idx = 0; idx < sizeof(laddrs.features[0]); idx++) {
- __u8 byte = laddrs.features[0][idx];
-
+ for (__u8 byte : laddrs.features[0]) {
if (is_dev_feat) {
node.source_has_arc_rx = (byte & CEC_OP_FEAT_DEV_SOURCE_HAS_ARC_RX) != 0;
node.sink_has_arc_tx = (byte & CEC_OP_FEAT_DEV_SINK_HAS_ARC_TX) != 0;
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index bc8c9c09..b3316753 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -763,14 +763,14 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
format_list.erase(format_list.end() - 1);
dev_info("Requested descriptors: %s\n", format_list.c_str());
for (unsigned i = 0; i < num_descriptors; i++) {
- for (unsigned j = 0; j < ARRAY_SIZE(supported_formats); j++) {
+ for (const auto &supported_format : supported_formats) {
if (found_descs >= 4)
break;
if ((audio_format_id[i] == 0 &&
- audio_format_code[i] == supported_formats[j].format_code) ||
+ audio_format_code[i] == supported_format.format_code) ||
(audio_format_id[i] == 1 &&
- audio_format_code[i] == supported_formats[j].extension_type_code))
- sad_encode(&supported_formats[j], &descriptors[found_descs++]);
+ audio_format_code[i] == supported_format.extension_type_code))
+ sad_encode(&supported_format, &descriptors[found_descs++]);
}
}
@@ -844,8 +844,8 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
static void poll_remote_devs(struct node *node, unsigned me)
{
node->remote_la_mask = 0;
- for (unsigned i = 0; i < 15; i++)
- node->remote_phys_addr[i] = CEC_PHYS_ADDR_INVALID;
+ for (unsigned short & i : node->remote_phys_addr)
+ i = CEC_PHYS_ADDR_INVALID;
if (!(node->caps & CEC_CAP_TRANSMIT))
return;
diff --git a/utils/libcecutil/cec-info.cpp b/utils/libcecutil/cec-info.cpp
index f6e60918..9a12e6a1 100644
--- a/utils/libcecutil/cec-info.cpp
+++ b/utils/libcecutil/cec-info.cpp
@@ -18,25 +18,25 @@
const char *cec_opcode2s(unsigned opcode)
{
- for (unsigned i = 0; i < sizeof(msgtable) / sizeof(msgtable[0]); i++)
- if (msgtable[i].opcode == opcode)
- return msgtable[i].name;
+ for (auto i : msgtable)
+ if (i.opcode == opcode)
+ return i.name;
return NULL;
}
const char *cec_cdc_opcode2s(unsigned cdc_opcode)
{
- for (unsigned i = 0; i < sizeof(cdcmsgtable) / sizeof(cdcmsgtable[0]); i++)
- if (cdcmsgtable[i].opcode == cdc_opcode)
- return cdcmsgtable[i].name;
+ for (auto i : cdcmsgtable)
+ if (i.opcode == cdc_opcode)
+ return i.name;
return NULL;
}
const char *cec_htng_opcode2s(unsigned htng_opcode)
{
- for (unsigned i = 0; i < sizeof(htngmsgtable) / sizeof(htngmsgtable[0]); i++)
- if (htngmsgtable[i].opcode == htng_opcode)
- return htngmsgtable[i].name;
+ for (auto i : htngmsgtable)
+ if (i.opcode == htng_opcode)
+ return i.name;
return NULL;
}
@@ -443,10 +443,8 @@ void cec_driver_info(const struct cec_caps &caps,
cec_all_dev_types2s(laddrs.all_device_types[i]).c_str());
bool is_dev_feat = false;
- for (unsigned idx = 0; idx < sizeof(laddrs.features[0]); idx++) {
- __u8 byte = laddrs.features[i][idx];
-
- if (!is_dev_feat) {
+ for (__u8 byte : laddrs.features[i]) {
+ if (!is_dev_feat) {
if (byte & 0x40) {
printf("\t RC Source Profile :\n%s",
cec_rc_src_prof2s(byte, "").c_str());
diff --git a/utils/libmedia_dev/get_media_devices.c b/utils/libmedia_dev/get_media_devices.c
index 491a94da..21920867 100644
--- a/utils/libmedia_dev/get_media_devices.c
+++ b/utils/libmedia_dev/get_media_devices.c
@@ -230,7 +230,7 @@ static int add_v4l_class(struct media_device_entry *md)
md->type = MEDIA_V4L_SUBDEV;
return 0;
-};
+}
static int add_snd_class(struct media_device_entry *md)
{
@@ -274,7 +274,7 @@ static int add_snd_class(struct media_device_entry *md)
md->node = strdup(node);
return 0;
-};
+}
static int add_dvb_class(struct media_device_entry *md)
{
@@ -298,7 +298,7 @@ static int add_dvb_class(struct media_device_entry *md)
md->type = MEDIA_DVB_OSD;
return 0;
-};
+}
static int sort_media_device_entry(const void *a, const void *b)
{
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()
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 92b4e995..5f9996fb 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -1270,8 +1270,8 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
node.valid_buftypes = 0;
node.valid_memorytype = 0;
node.buf_caps = 0;
- for (unsigned idx = 0; idx < V4L2_BUF_TYPE_LAST + 1; idx++)
- node.buftype_pixfmts[idx].clear();
+ for (auto &buftype_pixfmt : node.buftype_pixfmts)
+ buftype_pixfmt.clear();
if (max_io) {
sprintf(suffix, " (%s %u)",
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index cdfbbd34..d4b1eb8b 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -36,6 +36,7 @@
#include <signal.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
+#include <algorithm>
#include <atomic>
#include <map>
#include <vector>
@@ -2708,10 +2709,8 @@ static selTest createSelTest(struct node *node)
static bool haveSelTest(const selTest &test)
{
- for (unsigned i = 0; i < selTests.size(); i++)
- if (!memcmp(&selTests[i], &test, sizeof(test)))
- return true;
- return false;
+ return std::any_of(selTests.begin(), selTests.end(), [&](const selTest &selfTest)
+ { return &selfTest != &test; });
}
static void streamFmtRun(struct node *node, cv4l_fmt &fmt, unsigned frame_count,
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 73719cc3..b865e596 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -529,11 +529,11 @@ static int testFormatsType(struct node *node, int ret, unsigned type, struct v4
if (ret)
return fail("sliced.reserved not zeroed\n");
fail_on_test(sliced.service_lines[0][0] || sliced.service_lines[1][0]);
- for (int f = 0; f < 2; f++) {
- for (int i = 0; i < 24; i++) {
- if (sliced.service_lines[f][i])
+ for (const auto &service_line : sliced.service_lines) {
+ for (unsigned short i : service_line) {
+ if (i)
cnt++;
- service_set |= sliced.service_lines[f][i];
+ service_set |= i;
}
}
fail_on_test(sliced.io_size < sizeof(struct v4l2_sliced_vbi_data) * cnt);
@@ -1243,9 +1243,9 @@ static int testSlicedVBICapType(struct node *node, unsigned type)
fail_on_test(cap.type != type);
fail_on_test(!sliced_type || !(node->g_caps() & buftype2cap[type]));
- for (int f = 0; f < 2; f++)
- for (int i = 0; i < 24; i++)
- service_set |= cap.service_lines[f][i];
+ for (const auto &service_line : cap.service_lines)
+ for (unsigned short i : service_line)
+ service_set |= i;
fail_on_test(cap.service_set != service_set);
fail_on_test(cap.service_lines[0][0] || cap.service_lines[1][0]);
return 0;
diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp
index bcd8a725..f5101e33 100644
--- a/utils/v4l2-compliance/v4l2-test-media.cpp
+++ b/utils/v4l2-compliance/v4l2-test-media.cpp
@@ -393,9 +393,8 @@ int testMediaEnum(struct node *node)
}
fail_on_test(num_data_links != num_links);
- for (entity_map::iterator iter = ent_map.begin();
- iter != ent_map.end(); ++iter) {
- media_entity_desc &ent = iter->second;
+ for (auto & iter : ent_map) {
+ media_entity_desc &ent = iter.second;
memset(&links, 0, sizeof(links));
memset(&links.reserved, 0xff, sizeof(links.reserved));
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index 9b785cbf..ea026fd5 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -291,9 +291,8 @@ static void list_devices()
std::sort(files.begin(), files.end(), sort_on_device_name);
- for (dev_vec::iterator iter = files.begin();
- iter != files.end(); ++iter) {
- int fd = open(iter->c_str(), O_RDWR);
+ for (const auto &file : files) {
+ int fd = open(file.c_str(), O_RDWR);
std::string bus_info;
std::string card;
@@ -323,14 +322,13 @@ static void list_devices()
continue;
if (cards[bus_info].empty())
cards[bus_info] += card + " (" + bus_info + "):\n";
- cards[bus_info] += "\t" + (*iter);
- if (!(links[*iter].empty()))
- cards[bus_info] += " <- " + links[*iter];
+ cards[bus_info] += "\t" + file;
+ if (!(links[file].empty()))
+ cards[bus_info] += " <- " + links[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());
}
}
@@ -693,15 +691,15 @@ void common_process_controls(cv4l_fd &fd)
have_query_ext_ctrl = rc == 0;
find_controls(fd);
- for (ctrl_get_list::iterator iter = get_ctrls.begin(); iter != get_ctrls.end(); ++iter) {
- if (ctrl_str2q.find(*iter) == ctrl_str2q.end()) {
- fprintf(stderr, "unknown control '%s'\n", iter->c_str());
+ for (const auto &get_ctrl : get_ctrls) {
+ if (ctrl_str2q.find(get_ctrl) == ctrl_str2q.end()) {
+ fprintf(stderr, "unknown control '%s'\n", get_ctrl.c_str());
std::exit(EXIT_FAILURE);
}
}
- for (ctrl_set_map::iterator iter = set_ctrls.begin(); iter != set_ctrls.end(); ++iter) {
- if (ctrl_str2q.find(iter->first) == ctrl_str2q.end()) {
- fprintf(stderr, "unknown control '%s'\n", iter->first.c_str());
+ for (const auto &set_ctrl : set_ctrls) {
+ if (ctrl_str2q.find(set_ctrl.first) == ctrl_str2q.end()) {
+ fprintf(stderr, "unknown control '%s'\n", set_ctrl.first.c_str());
std::exit(EXIT_FAILURE);
}
}
@@ -914,10 +912,9 @@ void common_set(cv4l_fd &_fd)
bool use_ext_ctrls = false;
memset(&ctrls, 0, sizeof(ctrls));
- for (ctrl_set_map::iterator iter = set_ctrls.begin();
- iter != set_ctrls.end(); ++iter) {
+ for (const auto &set_ctrl : set_ctrls) {
struct v4l2_ext_control ctrl;
- struct v4l2_query_ext_ctrl &qc = ctrl_str2q[iter->first];
+ struct v4l2_query_ext_ctrl &qc = ctrl_str2q[set_ctrl.first];
memset(&ctrl, 0, sizeof(ctrl));
ctrl.id = qc.id;
@@ -953,29 +950,29 @@ void common_set(cv4l_fd &_fd)
switch (qc.type) {
case V4L2_CTRL_TYPE_U8:
- v = strtoul(iter->second.c_str(), NULL, 0);
+ v = strtoul(set_ctrl.second.c_str(), NULL, 0);
for (i = 0; i < qc.elems; i++)
if (idx_in_subset(qc, subset, divide, i))
ctrl.p_u8[i] = v;
break;
case V4L2_CTRL_TYPE_U16:
- v = strtoul(iter->second.c_str(), NULL, 0);
+ v = strtoul(set_ctrl.second.c_str(), NULL, 0);
for (i = 0; i < qc.elems; i++)
if (idx_in_subset(qc, subset, divide, i))
ctrl.p_u16[i] = v;
break;
case V4L2_CTRL_TYPE_U32:
- v = strtoul(iter->second.c_str(), NULL, 0);
+ v = strtoul(set_ctrl.second.c_str(), NULL, 0);
for (i = 0; i < qc.elems; i++)
if (idx_in_subset(qc, subset, divide, i))
ctrl.p_u32[i] = v;
break;
case V4L2_CTRL_TYPE_STRING:
- strncpy(ctrl.string, iter->second.c_str(), qc.maximum);
+ strncpy(ctrl.string, set_ctrl.second.c_str(), qc.maximum);
ctrl.string[qc.maximum] = 0;
break;
case V4L2_CTRL_TYPE_AREA:
- sscanf(iter->second.c_str(), "%ux%u",
+ sscanf(set_ctrl.second.c_str(), "%ux%u",
&ctrl.p_area->width, &ctrl.p_area->height);
break;
default:
@@ -986,20 +983,19 @@ void common_set(cv4l_fd &_fd)
} else {
if (V4L2_CTRL_DRIVER_PRIV(ctrl.id))
use_ext_ctrls = true;
- ctrl.value = strtol(iter->second.c_str(), NULL, 0);
+ ctrl.value = strtol(set_ctrl.second.c_str(), NULL, 0);
}
class2ctrls[V4L2_CTRL_ID2WHICH(ctrl.id)].push_back(ctrl);
}
- for (class2ctrls_map::iterator iter = class2ctrls.begin();
- iter != class2ctrls.end(); ++iter) {
+ for (auto &class2ctrl : class2ctrls) {
if (!use_ext_ctrls &&
- (iter->first == V4L2_CTRL_CLASS_USER ||
- iter->first == V4L2_CID_PRIVATE_BASE)) {
- for (unsigned i = 0; i < iter->second.size(); i++) {
+ (class2ctrl.first == V4L2_CTRL_CLASS_USER ||
+ class2ctrl.first == V4L2_CID_PRIVATE_BASE)) {
+ for (const auto &i : class2ctrl.second) {
struct v4l2_control ctrl;
- ctrl.id = iter->second[i].id;
- ctrl.value = iter->second[i].value;
+ ctrl.id = i.id;
+ ctrl.value = i.value;
if (doioctl(fd, VIDIOC_S_CTRL, &ctrl)) {
fprintf(stderr, "%s: %s\n",
ctrl_id2str[ctrl.id].c_str(),
@@ -1008,10 +1004,10 @@ void common_set(cv4l_fd &_fd)
}
continue;
}
- if (!iter->second.empty()) {
- ctrls.which = iter->first;
- ctrls.count = iter->second.size();
- ctrls.controls = &iter->second[0];
+ if (!class2ctrl.second.empty()) {
+ ctrls.which = class2ctrl.first;
+ ctrls.count = class2ctrl.second.size();
+ ctrls.controls = &class2ctrl.second[0];
if (doioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls)) {
if (ctrls.error_idx >= ctrls.count) {
fprintf(stderr, "Error setting controls: %s\n",
@@ -1019,7 +1015,7 @@ void common_set(cv4l_fd &_fd)
}
else {
fprintf(stderr, "%s: %s\n",
- ctrl_id2str[iter->second[ctrls.error_idx].id].c_str(),
+ ctrl_id2str[class2ctrl.second[ctrls.error_idx].id].c_str(),
strerror(errno));
}
}
@@ -1101,10 +1097,9 @@ void common_get(cv4l_fd &_fd)
bool use_ext_ctrls = false;
memset(&ctrls, 0, sizeof(ctrls));
- for (ctrl_get_list::iterator iter = get_ctrls.begin();
- iter != get_ctrls.end(); ++iter) {
+ for (const auto &get_ctrl : get_ctrls) {
struct v4l2_ext_control ctrl;
- struct v4l2_query_ext_ctrl &qc = ctrl_str2q[*iter];
+ struct v4l2_query_ext_ctrl &qc = ctrl_str2q[get_ctrl];
memset(&ctrl, 0, sizeof(ctrl));
ctrl.id = qc.id;
@@ -1120,28 +1115,26 @@ void common_get(cv4l_fd &_fd)
use_ext_ctrls = true;
class2ctrls[V4L2_CTRL_ID2WHICH(ctrl.id)].push_back(ctrl);
}
- for (class2ctrls_map::iterator iter = class2ctrls.begin();
- iter != class2ctrls.end(); ++iter) {
+ for (auto &class2ctrl : class2ctrls) {
if (!use_ext_ctrls &&
- (iter->first == V4L2_CTRL_CLASS_USER ||
- iter->first == V4L2_CID_PRIVATE_BASE)) {
- for (unsigned i = 0; i < iter->second.size(); i++) {
+ (class2ctrl.first == V4L2_CTRL_CLASS_USER ||
+ class2ctrl.first == V4L2_CID_PRIVATE_BASE)) {
+ for (const auto &i : class2ctrl.second) {
struct v4l2_control ctrl;
- ctrl.id = iter->second[i].id;
+ ctrl.id = i.id;
doioctl(fd, VIDIOC_G_CTRL, &ctrl);
printf("%s: %d\n", ctrl_id2str[ctrl.id].c_str(), ctrl.value);
}
continue;
}
- if (!iter->second.empty()) {
- ctrls.which = iter->first;
- ctrls.count = iter->second.size();
- ctrls.controls = &iter->second[0];
+ if (!class2ctrl.second.empty()) {
+ ctrls.which = class2ctrl.first;
+ ctrls.count = class2ctrl.second.size();
+ ctrls.controls = &class2ctrl.second[0];
doioctl(fd, VIDIOC_G_EXT_CTRLS, &ctrls);
- for (unsigned i = 0; i < iter->second.size(); i++) {
- struct v4l2_ext_control ctrl = iter->second[i];
- std::string &name = ctrl_id2str[ctrl.id];
+ for (auto ctrl : class2ctrl.second) {
+ std::string &name = ctrl_id2str[ctrl.id];
struct v4l2_query_ext_ctrl &qc = ctrl_str2q[name];
if (qc.flags & V4L2_CTRL_FLAG_HAS_PAYLOAD) {
diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
index 16344a15..7809a6db 100644
--- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
@@ -437,9 +437,7 @@ static void do_try_set_overlay(struct v4l2_format &fmt, int fd)
stride = (win.w.width + 7) / 8;
bitmap = static_cast<unsigned char *>(calloc(1, stride * win.w.height));
win.bitmap = bitmap;
- for (unsigned i = 0; i < bitmap_rects.size(); i++) {
- const v4l2_rect &r = bitmap_rects[i];
-
+ for (const auto &r : bitmap_rects) {
if (r.left + r.width > win.w.width ||
r.top + r.height > win.w.height) {
fprintf(stderr, "rectangle is out of range\n");
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 71714ec7..d986c7b6 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -879,10 +879,10 @@ static bool set_fwht_req_by_fd(const struct fwht_cframe_hdr *hdr,
set_fwht_stateless_params(fwht_params, hdr, last_bf_ts);
- for (int idx = 0; idx < VIDEO_MAX_FRAME; idx++) {
- if (fwht_reqs[idx].fd == req_fd) {
- fwht_reqs[idx].ts = ts;
- fwht_reqs[idx].params = fwht_params;
+ for (auto &fwht_req : fwht_reqs) {
+ if (fwht_req.fd == req_fd) {
+ fwht_req.ts = ts;
+ fwht_req.params = fwht_params;
return true;
}
}
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index 214fb9de..8b23752a 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -650,9 +650,8 @@ int main(int argc, char **argv)
get_reg.match = match;
printf("ioctl: VIDIOC_DBG_G_REGISTER\n");
- for (std::vector<std::string>::iterator iter = get_regs.begin();
- iter != get_regs.end(); ++iter) {
- get_reg.reg = parse_reg(curr_bd, *iter);
+ for (const auto ® : get_regs) {
+ get_reg.reg = parse_reg(curr_bd, reg);
if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &get_reg) < 0)
fprintf(stderr, "ioctl: VIDIOC_DBG_G_REGISTER "
"failed for 0x%llx\n", get_reg.reg);
--
2.26.2
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 7/8] [clang-tidy] fix mismatching declarations
2020-07-27 3:14 [PATCH 0/8] v4l-utils: C++11 modernization Rosen Penev
` (5 preceding siblings ...)
2020-07-27 3:14 ` [PATCH 6/8] [clang-tidy] convert files to reference Rosen Penev
@ 2020-07-27 3:14 ` Rosen Penev
2020-07-27 6:58 ` Mauro Carvalho Chehab
2020-07-27 3:14 ` [PATCH 8/8] [clang-tidy] use explicit for single argument constructors Rosen Penev
7 siblings, 1 reply; 11+ messages in thread
From: Rosen Penev @ 2020-07-27 3:14 UTC (permalink / raw)
To: linux-media
Found with readability-inconsistent-declaration-parameter-name
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
lib/include/libdvbv5/atsc_eit.h | 4 +-
lib/include/libdvbv5/cat.h | 4 +-
lib/include/libdvbv5/descriptors.h | 2 +-
lib/include/libdvbv5/dvb-demux.h | 2 +-
lib/include/libdvbv5/dvb-dev.h | 2 +-
lib/include/libdvbv5/dvb-fe.h | 2 +-
lib/include/libdvbv5/dvb-file.h | 4 +-
lib/include/libdvbv5/dvb-scan.h | 16 +++----
lib/include/libdvbv5/eit.h | 4 +-
| 4 +-
lib/include/libdvbv5/mgt.h | 4 +-
lib/include/libdvbv5/mpeg_pes.h | 2 +-
lib/include/libdvbv5/nit.h | 6 +--
lib/include/libdvbv5/pat.h | 4 +-
lib/include/libdvbv5/pmt.h | 4 +-
lib/include/libdvbv5/sdt.h | 4 +-
lib/include/libdvbv5/vct.h | 4 +-
lib/include/libv4l2.h | 2 +-
lib/libdvbv5/parse_string.h | 2 +-
lib/libv4lconvert/libv4lconvert-priv.h | 48 +++++++++----------
.../processing/libv4lprocessing.h | 2 +-
lib/libv4lconvert/tinyjpeg.h | 2 +-
utils/common/v4l-stream.h | 4 +-
utils/keytable/bpf.h | 6 +--
utils/libcecutil/cec-log.cpp | 12 ++---
25 files changed, 75 insertions(+), 75 deletions(-)
diff --git a/lib/include/libdvbv5/atsc_eit.h b/lib/include/libdvbv5/atsc_eit.h
index 5e52087c..18ae599d 100644
--- a/lib/include/libdvbv5/atsc_eit.h
+++ b/lib/include/libdvbv5/atsc_eit.h
@@ -192,7 +192,7 @@ ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct atsc_table_eit to be freed
*/
-void atsc_table_eit_free(struct atsc_table_eit *table);
+void atsc_table_eit_free(struct atsc_table_eit *eit);
/**
* @brief Prints the content of the ATSC EIT table
@@ -202,7 +202,7 @@ void atsc_table_eit_free(struct atsc_table_eit *table);
* @param table pointer to struct atsc_table_eit
*/
void atsc_table_eit_print(struct dvb_v5_fe_parms *parms,
- struct atsc_table_eit *table);
+ struct atsc_table_eit *eit);
/**
* @brief Converts an ATSC EIT formatted timestamp into struct tm
diff --git a/lib/include/libdvbv5/cat.h b/lib/include/libdvbv5/cat.h
index 612c2c35..2e767ddc 100644
--- a/lib/include/libdvbv5/cat.h
+++ b/lib/include/libdvbv5/cat.h
@@ -88,7 +88,7 @@ ssize_t dvb_table_cat_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_cat to be freed
*/
-void dvb_table_cat_free(struct dvb_table_cat *table);
+void dvb_table_cat_free(struct dvb_table_cat *cat);
/**
* @brief Prints the content of the CAT table
@@ -97,7 +97,7 @@ void dvb_table_cat_free(struct dvb_table_cat *table);
* @param table pointer to struct dvb_table_cat
*/
void dvb_table_cat_print(struct dvb_v5_fe_parms *parms,
- struct dvb_table_cat *table);
+ struct dvb_table_cat *cat);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/descriptors.h b/lib/include/libdvbv5/descriptors.h
index cb21470c..8f3900f2 100644
--- a/lib/include/libdvbv5/descriptors.h
+++ b/lib/include/libdvbv5/descriptors.h
@@ -157,7 +157,7 @@ uint32_t dvb_bcd(uint32_t bcd);
* @param len Number of bytes to show
*/
void dvb_hexdump(struct dvb_v5_fe_parms *parms, const char *prefix,
- const unsigned char *buf, int len);
+ const unsigned char *data, int len);
/**
* @brief parse MPEG-TS descriptors
diff --git a/lib/include/libdvbv5/dvb-demux.h b/lib/include/libdvbv5/dvb-demux.h
index 971c27f6..d3bc02a9 100644
--- a/lib/include/libdvbv5/dvb-demux.h
+++ b/lib/include/libdvbv5/dvb-demux.h
@@ -148,7 +148,7 @@ int dvb_set_section_filter(int dmxfd, int pid, unsigned filtsize,
*
* @warning This function currently assumes that the PAT fits into one session.
*/
-int dvb_get_pmt_pid(int dmxfd, int sid);
+int dvb_get_pmt_pid(int patfd, int sid);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/dvb-dev.h b/lib/include/libdvbv5/dvb-dev.h
index 2eeae516..5a9cc1a2 100644
--- a/lib/include/libdvbv5/dvb-dev.h
+++ b/lib/include/libdvbv5/dvb-dev.h
@@ -398,7 +398,7 @@ int dvb_dev_set_bufsize(struct dvb_open_descriptor *open_dev,
*/
int dvb_dev_dmx_set_pesfilter(struct dvb_open_descriptor *open_dev,
int pid, dmx_pes_type_t type,
- dmx_output_t output, int buffersize);
+ dmx_output_t output, int bufsize);
/**
* @brief Sets a MPEG-TS section filter
diff --git a/lib/include/libdvbv5/dvb-fe.h b/lib/include/libdvbv5/dvb-fe.h
index 96657013..4bd94108 100644
--- a/lib/include/libdvbv5/dvb-fe.h
+++ b/lib/include/libdvbv5/dvb-fe.h
@@ -732,7 +732,7 @@ int dvb_fe_is_satellite(uint32_t delivery_system);
* "COUNTRY" property in dvb_fe_set_parm() overrides the setting.
*/
int dvb_fe_set_default_country(struct dvb_v5_fe_parms *parms,
- const char *country);
+ const char *cc);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/dvb-file.h b/lib/include/libdvbv5/dvb-file.h
index 1f1a6386..9c8c54d9 100644
--- a/lib/include/libdvbv5/dvb-file.h
+++ b/lib/include/libdvbv5/dvb-file.h
@@ -423,8 +423,8 @@ int dvb_retrieve_entry_prop(struct dvb_entry *entry,
* @return Returns 0 if success, or, -1 if error.
*/
int dvb_store_channel(struct dvb_file **dvb_file,
- struct dvb_v5_fe_parms *parms,
- struct dvb_v5_descriptors *dvb_desc,
+ struct dvb_v5_fe_parms *__p,
+ struct dvb_v5_descriptors *dvb_scan_handler,
int get_detected, int get_nit);
/**
diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
index 2666d906..50846b98 100644
--- a/lib/include/libdvbv5/dvb-scan.h
+++ b/lib/include/libdvbv5/dvb-scan.h
@@ -222,7 +222,7 @@ int dvb_read_section(struct dvb_v5_fe_parms *parms, int dmx_fd,
* This is a variant of dvb_read_section() that uses a struct dvb_table_filter
* to specify the filter to use.
*/
-int dvb_read_sections(struct dvb_v5_fe_parms *parms, int dmx_fd,
+int dvb_read_sections(struct dvb_v5_fe_parms *__p, int dmx_fd,
struct dvb_table_filter *sect,
unsigned timeout);
@@ -265,7 +265,7 @@ void dvb_scan_free_handler_table(struct dvb_v5_descriptors *dvb_scan_handler);
* On sucess, it returns a pointer to a struct dvb_v5_descriptors, that can
* either be used to tune into a service or to be stored inside a file.
*/
-struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *parms, int dmx_fd,
+struct dvb_v5_descriptors *dvb_get_ts_tables(struct dvb_v5_fe_parms *__p, int dmx_fd,
uint32_t delivery_system,
unsigned other_nit,
unsigned timeout_multiply);
@@ -337,7 +337,7 @@ typedef int (check_frontend_t)(void *args, struct dvb_v5_fe_parms *parms);
* }
* @endcode
*/
-struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
+struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *__p,
struct dvb_entry *entry,
int dmx_fd,
check_frontend_t *check_frontend,
@@ -388,7 +388,7 @@ struct dvb_v5_descriptors *dvb_scan_transponder(struct dvb_v5_fe_parms *parms,
* }
* @endcode
*/
-void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
+void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *__p,
struct dvb_v5_descriptors *dvb_scan_handler,
struct dvb_entry *first_entry,
struct dvb_entry *entry);
@@ -398,12 +398,12 @@ void dvb_add_scaned_transponders(struct dvb_v5_fe_parms *parms,
* Some ancillary functions used internally inside the library, used to
* identify duplicated transport streams and add new found transponder entries
*/
-int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
+int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p);
int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
uint32_t freq, enum dvb_sat_polarization pol, int shift);
-struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
+struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
struct dvb_entry *first_entry,
struct dvb_entry *entry,
uint32_t freq, uint32_t shift,
@@ -414,14 +414,14 @@ int dvb_new_entry_is_needed(struct dvb_entry *entry,
uint32_t freq, int shift,
enum dvb_sat_polarization pol, uint32_t stream_id);
-struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *parms,
+struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p,
struct dvb_entry *first_entry,
struct dvb_entry *entry,
uint32_t freq, uint32_t shift,
enum dvb_sat_polarization pol,
uint32_t stream_id);
-void dvb_update_transponders(struct dvb_v5_fe_parms *parms,
+void dvb_update_transponders(struct dvb_v5_fe_parms *__p,
struct dvb_v5_descriptors *dvb_scan_handler,
struct dvb_entry *first_entry,
struct dvb_entry *entry);
diff --git a/lib/include/libdvbv5/eit.h b/lib/include/libdvbv5/eit.h
index 9129861e..5510707b 100644
--- a/lib/include/libdvbv5/eit.h
+++ b/lib/include/libdvbv5/eit.h
@@ -197,7 +197,7 @@ ssize_t dvb_table_eit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_eit to be freed
*/
-void dvb_table_eit_free(struct dvb_table_eit *table);
+void dvb_table_eit_free(struct dvb_table_eit *eit);
/**
* @brief Prints the content of the DVB EIT table
@@ -207,7 +207,7 @@ void dvb_table_eit_free(struct dvb_table_eit *table);
* @param table pointer to struct dvb_table_eit
*/
void dvb_table_eit_print(struct dvb_v5_fe_parms *parms,
- struct dvb_table_eit *table);
+ struct dvb_table_eit *eit);
/**
* @brief Converts a DVB EIT formatted timestamp into struct tm
--git a/lib/include/libdvbv5/header.h b/lib/include/libdvbv5/header.h
index 2a459f9d..ccf67422 100644
--- a/lib/include/libdvbv5/header.h
+++ b/lib/include/libdvbv5/header.h
@@ -132,7 +132,7 @@ extern "C" {
*
* @param header pointer to struct dvb_table_header to be parsed
*/
-void dvb_table_header_init (struct dvb_table_header *header);
+void dvb_table_header_init (struct dvb_table_header *t);
/**
* @brief Prints the content of the MPEG-TS table header
* @ingroup dvb_table
@@ -141,7 +141,7 @@ void dvb_table_header_init (struct dvb_table_header *header);
* @param header pointer to struct dvb_table_header to be printed
*/
void dvb_table_header_print(struct dvb_v5_fe_parms *parms,
- const struct dvb_table_header *header);
+ const struct dvb_table_header *t);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/mgt.h b/lib/include/libdvbv5/mgt.h
index 7aa92d6c..62b5a7ab 100644
--- a/lib/include/libdvbv5/mgt.h
+++ b/lib/include/libdvbv5/mgt.h
@@ -168,7 +168,7 @@ ssize_t atsc_table_mgt_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct atsc_table_mgt to be freed
*/
-void atsc_table_mgt_free(struct atsc_table_mgt *table);
+void atsc_table_mgt_free(struct atsc_table_mgt *mgt);
/**
* @brief Prints the content of the MGT table
@@ -178,7 +178,7 @@ void atsc_table_mgt_free(struct atsc_table_mgt *table);
* @param table pointer to struct atsc_table_mgt
*/
void atsc_table_mgt_print(struct dvb_v5_fe_parms *parms,
- struct atsc_table_mgt *table);
+ struct atsc_table_mgt *mgt);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/mpeg_pes.h b/lib/include/libdvbv5/mpeg_pes.h
index 9f214b26..b2b13584 100644
--- a/lib/include/libdvbv5/mpeg_pes.h
+++ b/lib/include/libdvbv5/mpeg_pes.h
@@ -228,7 +228,7 @@ ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssi
* If the pointer pes was allocated dynamically, this function
* can be used to free the memory.
*/
-void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes);
+void dvb_mpeg_pes_free(struct dvb_mpeg_pes *ts);
/**
* @brief Print details of struct dvb_mpeg_pes
diff --git a/lib/include/libdvbv5/nit.h b/lib/include/libdvbv5/nit.h
index f8e0e730..ef0f1bc1 100644
--- a/lib/include/libdvbv5/nit.h
+++ b/lib/include/libdvbv5/nit.h
@@ -221,7 +221,7 @@ ssize_t dvb_table_nit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_nit to be freed
*/
-void dvb_table_nit_free(struct dvb_table_nit *table);
+void dvb_table_nit_free(struct dvb_table_nit *nit);
/**
* @brief Prints the content of the NIT table
@@ -230,7 +230,7 @@ void dvb_table_nit_free(struct dvb_table_nit *table);
* @param parms struct dvb_v5_fe_parms pointer to the opened device
* @param table pointer to struct dvb_table_nit
*/
-void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table);
+void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *nit);
/**
* @brief For each entry at NIT and NIT transport tables, call a callback
@@ -263,7 +263,7 @@ void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *ta
*/
void dvb_table_nit_descriptor_handler(
struct dvb_v5_fe_parms *parms,
- struct dvb_table_nit *table,
+ struct dvb_table_nit *nit,
enum descriptors descriptor,
nit_handler_callback_t *call_nit,
nit_tran_handler_callback_t *call_tran,
diff --git a/lib/include/libdvbv5/pat.h b/lib/include/libdvbv5/pat.h
index bdf31ab5..9b1303a1 100644
--- a/lib/include/libdvbv5/pat.h
+++ b/lib/include/libdvbv5/pat.h
@@ -153,7 +153,7 @@ ssize_t dvb_table_pat_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_pat to be freed
*/
-void dvb_table_pat_free(struct dvb_table_pat *table);
+void dvb_table_pat_free(struct dvb_table_pat *pat);
/**
* @brief Prints the content of the PAT table
@@ -163,7 +163,7 @@ void dvb_table_pat_free(struct dvb_table_pat *table);
* @param table pointer to struct dvb_table_pat
*/
void dvb_table_pat_print(struct dvb_v5_fe_parms *parms,
- struct dvb_table_pat *table);
+ struct dvb_table_pat *pat);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/pmt.h b/lib/include/libdvbv5/pmt.h
index 5876c594..45ce88b0 100644
--- a/lib/include/libdvbv5/pmt.h
+++ b/lib/include/libdvbv5/pmt.h
@@ -281,7 +281,7 @@ ssize_t dvb_table_pmt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_pmt to be freed
*/
-void dvb_table_pmt_free(struct dvb_table_pmt *table);
+void dvb_table_pmt_free(struct dvb_table_pmt *pmt);
/**
* @brief Prints the content of the PAT table
@@ -291,7 +291,7 @@ void dvb_table_pmt_free(struct dvb_table_pmt *table);
* @param table pointer to struct dvb_table_pmt
*/
void dvb_table_pmt_print(struct dvb_v5_fe_parms *parms,
- const struct dvb_table_pmt *table);
+ const struct dvb_table_pmt *pmt);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/sdt.h b/lib/include/libdvbv5/sdt.h
index 52fdf07f..1292f82d 100644
--- a/lib/include/libdvbv5/sdt.h
+++ b/lib/include/libdvbv5/sdt.h
@@ -169,7 +169,7 @@ ssize_t dvb_table_sdt_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct dvb_table_sdt to be freed
*/
-void dvb_table_sdt_free(struct dvb_table_sdt *table);
+void dvb_table_sdt_free(struct dvb_table_sdt *sdt);
/**
* @brief Prints the content of the SDT table
@@ -178,7 +178,7 @@ void dvb_table_sdt_free(struct dvb_table_sdt *table);
* @param parms struct dvb_v5_fe_parms pointer to the opened device
* @param table pointer to struct dvb_table_sdt
*/
-void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *table);
+void dvb_table_sdt_print(struct dvb_v5_fe_parms *parms, struct dvb_table_sdt *sdt);
#ifdef __cplusplus
}
diff --git a/lib/include/libdvbv5/vct.h b/lib/include/libdvbv5/vct.h
index 374c73a8..86c4728a 100644
--- a/lib/include/libdvbv5/vct.h
+++ b/lib/include/libdvbv5/vct.h
@@ -233,7 +233,7 @@ ssize_t atsc_table_vct_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
*
* @param table pointer to struct atsc_table_vct to be freed
*/
-void atsc_table_vct_free(struct atsc_table_vct *table);
+void atsc_table_vct_free(struct atsc_table_vct *vct);
/**
* @brief Prints the content of the VCT table
* @ingroup dvb_table
@@ -242,7 +242,7 @@ void atsc_table_vct_free(struct atsc_table_vct *table);
* @param table pointer to struct atsc_table_vct
*/
void atsc_table_vct_print(struct dvb_v5_fe_parms *parms,
- struct atsc_table_vct *table);
+ struct atsc_table_vct *vct);
#ifdef __cplusplus
}
diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h
index ea1870db..5c093067 100644
--- a/lib/include/libv4l2.h
+++ b/lib/include/libv4l2.h
@@ -64,7 +64,7 @@ LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...);
LIBV4L_PUBLIC int v4l2_close(int fd);
LIBV4L_PUBLIC int v4l2_dup(int fd);
LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...);
-LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *buffer, size_t n);
+LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *dest, size_t n);
LIBV4L_PUBLIC ssize_t v4l2_write(int fd, const void *buffer, size_t n);
LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags,
int fd, int64_t offset);
diff --git a/lib/libdvbv5/parse_string.h b/lib/libdvbv5/parse_string.h
index b0884bfb..86604bde 100644
--- a/lib/libdvbv5/parse_string.h
+++ b/lib/libdvbv5/parse_string.h
@@ -27,7 +27,7 @@ void dvb_iconv_to_charset(struct dvb_v5_fe_parms *parms,
size_t destlen,
const unsigned char *src,
size_t len,
- char *type, char *output_charset);
+ char *input_charset, char *output_charset);
void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph,
const unsigned char *src, size_t len);
diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h
index ce5970c9..dd168424 100644
--- a/lib/libv4lconvert/libv4lconvert-priv.h
+++ b/lib/libv4lconvert/libv4lconvert-priv.h
@@ -117,43 +117,43 @@ int v4lconvert_oom_error(struct v4lconvert_data *data);
void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest,
const struct v4l2_format *src_fmt, int bgr, int yvu, int bpp);
-void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int yvu);
-void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dest,
int width, int height, int yvu);
-void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuyv_to_bgr24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dest,
int width, int height, int stride, int yvu);
void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest,
int width, int height);
-void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_yvyu_to_bgr24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_uyvy_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_uyvy_to_bgr24(const unsigned char *src, unsigned char *dest,
int width, int height, int stride);
-void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dst,
+void v4lconvert_uyvy_to_yuv420(const unsigned char *src, unsigned char *dest,
int width, int height, int stride, int yvu);
void v4lconvert_swap_rgb(const unsigned char *src, unsigned char *dst,
int width, int height);
-void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst,
+void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dest,
const struct v4l2_format *src_fmt);
void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest,
@@ -209,9 +209,9 @@ void v4lconvert_m420_to_yuv420(const unsigned char *src,
int v4lconvert_cpia1_to_yuv420(struct v4lconvert_data *data,
const unsigned char *src, int src_size,
- unsigned char *dst, int width, int height, int yvu);
+ unsigned char *dest, int width, int height, int yvu);
-void v4lconvert_sn9c20x_to_yuv420(const unsigned char *src, unsigned char *dst,
+void v4lconvert_sn9c20x_to_yuv420(const unsigned char *raw, unsigned char *i420,
int width, int height, int yvu);
int v4lconvert_se401_to_rgb24(struct v4lconvert_data *data,
@@ -226,13 +226,13 @@ int v4lconvert_decode_jpeg_libjpeg(struct v4lconvert_data *data,
unsigned char *src, int src_size, unsigned char *dest,
struct v4l2_format *fmt, unsigned int dest_pix_fmt);
-int v4lconvert_decode_jpgl(const unsigned char *src, int src_size,
- unsigned int dest_pix_fmt, unsigned char *dest, int width, int height);
+int v4lconvert_decode_jpgl(const unsigned char *inp, int src_size,
+ unsigned int dest_pix_fmt, unsigned char *fb, int width, int height);
-void v4lconvert_decode_spca561(const unsigned char *src, unsigned char *dst,
+void v4lconvert_decode_spca561(const unsigned char *inbuf, unsigned char *outbuf,
int width, int height);
-void v4lconvert_decode_sn9c10x(const unsigned char *src, unsigned char *dst,
+void v4lconvert_decode_sn9c10x(const unsigned char *inp, unsigned char *outp,
int width, int height);
int v4lconvert_decode_pac207(struct v4lconvert_data *data,
@@ -240,7 +240,7 @@ int v4lconvert_decode_pac207(struct v4lconvert_data *data,
int width, int height);
int v4lconvert_decode_mr97310a(struct v4lconvert_data *data,
- const unsigned char *src, int src_size, unsigned char *dst,
+ const unsigned char *inp, int src_size, unsigned char *outp,
int width, int height);
int v4lconvert_decode_jl2005bcd(struct v4lconvert_data *data,
@@ -257,10 +257,10 @@ void v4lconvert_decode_stv0680(const unsigned char *src, unsigned char *dst,
int width, int height);
void v4lconvert_bayer_to_rgb24(const unsigned char *bayer,
- unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
+ unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt);
void v4lconvert_bayer_to_bgr24(const unsigned char *bayer,
- unsigned char *rgb, int width, int height, const unsigned int stride, unsigned int pixfmt);
+ unsigned char *bgr, int width, int height, const unsigned int stride, unsigned int pixfmt);
void v4lconvert_bayer_to_yuv420(const unsigned char *bayer, unsigned char *yuv,
int width, int height, const unsigned int stride, unsigned int src_pixfmt, int yvu);
@@ -275,13 +275,13 @@ void v4lconvert_bayer16_to_bayer8(unsigned char *bayer16,
unsigned char *bayer8, int width, int height);
void v4lconvert_hm12_to_rgb24(const unsigned char *src,
- unsigned char *dst, int width, int height);
+ unsigned char *dest, int width, int height);
void v4lconvert_hm12_to_bgr24(const unsigned char *src,
- unsigned char *dst, int width, int height);
+ unsigned char *dest, int width, int height);
void v4lconvert_hm12_to_yuv420(const unsigned char *src,
- unsigned char *dst, int width, int height, int yvu);
+ unsigned char *dest, int width, int height, int yvu);
void v4lconvert_hsv_to_rgb24(const unsigned char *src, unsigned char *dest,
int width, int height, int bgr, int Xin, unsigned char hsv_enc);
@@ -303,7 +303,7 @@ void v4lconvert_crop(unsigned char *src, unsigned char *dest,
int v4lconvert_helper_decompress(struct v4lconvert_data *data,
const char *helper, const unsigned char *src, int src_size,
- unsigned char *dest, int dest_size, int width, int height, int command);
+ unsigned char *dest, int dest_size, int width, int height, int flags);
void v4lconvert_helper_cleanup(struct v4lconvert_data *data);
diff --git a/lib/libv4lconvert/processing/libv4lprocessing.h b/lib/libv4lconvert/processing/libv4lprocessing.h
index d135a9d6..52184a7c 100644
--- a/lib/libv4lconvert/processing/libv4lprocessing.h
+++ b/lib/libv4lconvert/processing/libv4lprocessing.h
@@ -31,7 +31,7 @@
struct v4lprocessing_data;
struct v4lcontrol_data;
-struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *data);
+struct v4lprocessing_data *v4lprocessing_create(int fd, struct v4lcontrol_data *control);
void v4lprocessing_destroy(struct v4lprocessing_data *data);
/* Prepare to process 1 frame, returns 1 if processing is necesary,
diff --git a/lib/libv4lconvert/tinyjpeg.h b/lib/libv4lconvert/tinyjpeg.h
index ee61d234..857f833d 100644
--- a/lib/libv4lconvert/tinyjpeg.h
+++ b/lib/libv4lconvert/tinyjpeg.h
@@ -58,7 +58,7 @@ struct jdec_private *tinyjpeg_init(void);
void tinyjpeg_free(struct jdec_private *priv);
int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, unsigned int size);
-int tinyjpeg_decode(struct jdec_private *priv, int pixel_format);
+int tinyjpeg_decode(struct jdec_private *priv, int pixfmt);
const char *tinyjpeg_get_errorstring(struct jdec_private *priv);
void tinyjpeg_get_size(struct jdec_private *priv, unsigned int *width, unsigned int *height);
int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **components);
diff --git a/utils/common/v4l-stream.h b/utils/common/v4l-stream.h
index fe5dfe90..e6b6c27d 100644
--- a/utils/common/v4l-stream.h
+++ b/utils/common/v4l-stream.h
@@ -144,8 +144,8 @@ struct codec_ctx {
u32 comp_max_size;
};
-unsigned rle_compress(__u8 *buf, unsigned size, unsigned bytesperline);
-void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bytesperline);
+unsigned rle_compress(__u8 *buf, unsigned size, unsigned bpl);
+void rle_decompress(__u8 *buf, unsigned size, unsigned rle_size, unsigned bpl);
struct codec_ctx *fwht_alloc(unsigned pixfmt, unsigned visible_width, unsigned visible_height,
unsigned coded_width, unsigned coded_height, unsigned field,
unsigned colorspace, unsigned xfer_func, unsigned ycbcr_enc,
diff --git a/utils/keytable/bpf.h b/utils/keytable/bpf.h
index fb3896c9..f09232cf 100644
--- a/utils/keytable/bpf.h
+++ b/utils/keytable/bpf.h
@@ -89,10 +89,10 @@ int bpf_map_delete_elem(int fd, const void *key);
int bpf_map_get_next_key(int fd, const void *key, void *next_key);
int bpf_obj_pin(int fd, const char *pathname);
int bpf_obj_get(const char *pathname);
-int bpf_prog_attach(int prog_fd, int attachable_fd, enum bpf_attach_type type,
+int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type,
unsigned int flags);
-int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type);
-int bpf_prog_detach2(int prog_fd, int attachable_fd, enum bpf_attach_type type);
+int bpf_prog_detach(int target_fd, enum bpf_attach_type type);
+int bpf_prog_detach2(int prog_fd, int target_fd, enum bpf_attach_type type);
int bpf_prog_test_run(int prog_fd, int repeat, void *data, __u32 size,
void *data_out, __u32 *size_out, __u32 *retval,
__u32 *duration);
diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp
index 9410c071..56676431 100644
--- a/utils/libcecutil/cec-log.cpp
+++ b/utils/libcecutil/cec-log.cpp
@@ -102,12 +102,12 @@ static const struct cec_arg arg_rec_src_type = {
};
static void log_digital(const char *arg_name, const struct cec_op_digital_service_id *digital);
-static void log_rec_src(const char *arg_name, const struct cec_op_record_src *rec_src);
-static void log_tuner_dev_info(const char *arg_name, const struct cec_op_tuner_device_info *tuner_dev_info);
-static void log_features(const struct cec_arg *arg, const char *arg_name, const __u8 *p);
-static void log_ui_command(const char *arg_name, const struct cec_op_ui_command *ui_cmd);
-static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors);
-static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals);
+static void log_rec_src(const char *arg_string, const struct cec_op_record_src *rec_src);
+static void log_tuner_dev_info(const char *arg_string, const struct cec_op_tuner_device_info *tuner_dev_info);
+static void log_features(const struct cec_arg *arg, const char *arg_string, const __u8 *p);
+static void log_ui_command(const char *arg_string, const struct cec_op_ui_command *ui_cmd);
+static void log_descriptors(const char *arg_string, unsigned num, const __u32 *descriptors);
+static void log_u8_array(const char *arg_string, unsigned num, const __u8 *vals);
static void log_unknown_msg(const struct cec_msg *msg);
static void log_htng_unknown_msg(const struct cec_msg *msg);
--
2.26.2
^ permalink raw reply related [flat|nested] 11+ messages in thread