@@ -655,7 +655,7 @@ int cec_named_ioctl(struct node *node, const char *name,
{
int retval;
int e;
- struct cec_msg *msg = static_cast<struct cec_msg *>(parm);
+ auto msg = static_cast<struct cec_msg *>(parm);
__u8 opcode = 0;
std::string opname;
@@ -1502,7 +1502,7 @@ void collectTests()
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;
+ auto func = (__u64)test.subtests[j].test_fn;
if (mapTestFuncs.find(name) != mapTestFuncs.end() &&
mapTestFuncs[name] != func) {
@@ -1772,7 +1772,7 @@ static void list_devices()
closedir(dp);
/* Find device nodes which are links to other device nodes */
- for (dev_vec::iterator iter = files.begin();
+ for (auto iter = files.begin();
iter != files.end(); ) {
char link[64+1];
int link_len;
@@ -277,7 +277,7 @@ int cec_named_ioctl(int fd, const char *name,
name, retval, strerror(e));
if (!retval) {
- const struct cec_msg *msg = static_cast<const struct cec_msg *>(parm);
+ const auto msg = static_cast<const struct cec_msg *>(parm);
/* Update the timestamp whenever we successfully transmit to an LA,
or whenever we receive something from the LA */
@@ -346,7 +346,7 @@ static dev_vec list_devices()
/* Iterate through all devices, and remove all non-accessible devices
* and all devices that don't offer the RDS_BLOCK_IO capability */
- for (dev_vec::iterator iter = files.begin();
+ for (auto iter = files.begin();
iter != files.end();) {
int fd = open(iter->c_str(), O_RDONLY | O_NONBLOCK);
std::string bus_info;
@@ -900,11 +900,11 @@ static std::string make_devname(const char *device, const char *devname,
return device;
}
- media_v2_entity *ents = new media_v2_entity[topology.num_entities];
+ auto ents = new media_v2_entity[topology.num_entities];
topology.ptr_entities = (uintptr_t)ents;
- media_v2_link *links = new media_v2_link[topology.num_links];
+ auto links = new media_v2_link[topology.num_links];
topology.ptr_links = (uintptr_t)links;
- media_v2_interface *ifaces = new media_v2_interface[topology.num_interfaces];
+ auto ifaces = new media_v2_interface[topology.num_interfaces];
topology.ptr_interfaces = (uintptr_t)ifaces;
unsigned i, ent_id, iface_id = 0;
@@ -1681,7 +1681,7 @@ int testUserPtr(struct node *node, struct node *node_m2m_cap, unsigned frame_cou
for (unsigned p = 0; p < q.g_num_planes(); p++) {
/* ensure that len is a multiple of 4 */
__u32 len = ((q.g_length(p) + 3) & ~0x3) + 4 * 4096;
- __u32 *m = static_cast<__u32 *>(malloc(len));
+ auto m = static_cast<__u32 *>(malloc(len));
fail_on_test(!m);
fail_on_test((uintptr_t)m & 0x7);
@@ -1740,7 +1740,7 @@ int testUserPtr(struct node *node, struct node *node_m2m_cap, unsigned frame_cou
__u32 buflen = (q.g_length(p) + 3U) & ~3U;
__u32 memlen = buflen + 4 * 4096;
__u32 *m = buffers[i][p];
- __u32 *u = static_cast<__u32 *>(q.g_userptr(i, p));
+ auto u = static_cast<__u32 *>(q.g_userptr(i, p));
for (__u32 *x = m; x < u; x++)
if (*x != filler)
@@ -2372,7 +2372,7 @@ public:
private:
static void *startRoutine(void *arg)
{
- BlockingThread *self = static_cast<BlockingThread *>(arg);
+ auto self = static_cast<BlockingThread *>(arg);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
@@ -225,7 +225,7 @@ static void list_media_devices(const std::string &media_bus_info)
return;
}
- media_v2_interface *ifaces = new media_v2_interface[topology.num_interfaces];
+ auto ifaces = new media_v2_interface[topology.num_interfaces];
topology.ptr_interfaces = (uintptr_t)ifaces;
if (!ioctl(media_fd, MEDIA_IOC_G_TOPOLOGY, &topology))
@@ -259,7 +259,7 @@ static void list_devices()
closedir(dp);
/* Find device nodes which are links to other device nodes */
- for (dev_vec::iterator iter = files.begin();
+ for (auto iter = files.begin();
iter != files.end(); ) {
char link[64+1];
int link_len;
@@ -1,3 +1,4 @@
+#include <algorithm>
#include <cstdlib>
#include <cstring>
@@ -366,7 +366,7 @@ void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q)
'.', ',', ':', ';', '!', '|', 'i', 'c',
'n', 'o', 'm', 'I', 'C', 'N', 'O', 'M',
};
- __s16 *vbuf = static_cast<__s16 *>(q.g_dataptr(buf.g_index(), 0));
+ auto vbuf = static_cast<__s16 *>(q.g_dataptr(buf.g_index(), 0));
__u32 x, y;
switch (fmt.g_pixelformat()) {
@@ -375,7 +375,7 @@ void print_touch_buffer(FILE *f, cv4l_buffer &buf, cv4l_fmt &fmt, cv4l_queue &q)
fprintf(f, "TD16: ");
for (x = 0; x < fmt.g_width(); x++, vbuf++) {
- __s16 v = static_cast<__s16>(le16toh(*vbuf));
+ auto v = static_cast<__s16>(le16toh(*vbuf));
if (!options[OptConcise])
fprintf(f, "% 4d", v);
@@ -484,7 +484,7 @@ void printfmt(int fd, const struct v4l2_format &vfmt)
}
printf("\tClip Bitmap : %s", vfmt.fmt.win.bitmap ? "Yes, " : "No\n");
if (vfmt.fmt.win.bitmap) {
- unsigned char *bitmap = static_cast<unsigned char *>(vfmt.fmt.win.bitmap);
+ auto bitmap = static_cast<unsigned char *>(vfmt.fmt.win.bitmap);
unsigned stride = (vfmt.fmt.win.w.width + 7) / 8;
unsigned cnt = 0;
@@ -1056,11 +1056,11 @@ static const char *make_devname(const char *device, const char *devname,
return device;
}
- media_v2_entity *ents = new media_v2_entity[topology.num_entities];
+ auto ents = new media_v2_entity[topology.num_entities];
topology.ptr_entities = (uintptr_t)ents;
- media_v2_link *links = new media_v2_link[topology.num_links];
+ auto links = new media_v2_link[topology.num_links];
topology.ptr_links = (uintptr_t)links;
- media_v2_interface *ifaces = new media_v2_interface[topology.num_interfaces];
+ auto ifaces = new media_v2_interface[topology.num_interfaces];
topology.ptr_interfaces = (uintptr_t)ifaces;
unsigned i, ent_id, iface_id = 0;
Found with modernize-use-auto Signed-off-by: Rosen Penev <rosenp@gmail.com> --- utils/cec-compliance/cec-compliance.cpp | 2 +- utils/cec-compliance/cec-test.cpp | 2 +- utils/cec-ctl/cec-ctl.cpp | 2 +- utils/cec-follower/cec-follower.cpp | 2 +- utils/rds-ctl/rds-ctl.cpp | 2 +- utils/v4l2-compliance/v4l2-compliance.cpp | 6 +++--- utils/v4l2-compliance/v4l2-test-buffers.cpp | 6 +++--- utils/v4l2-ctl/v4l2-ctl-common.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 1 + utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl.cpp | 8 ++++---- 11 files changed, 20 insertions(+), 19 deletions(-)