utils: replace strchr with std variant
PATCH 1/7 utils: replace strchr with std variant
--- utils/cec-compliance/cec-test.cpp | 5 +++-- utils/cec-ctl/cec-ctl.cpp | 13 +++++++------ utils/cec-follower/cec-follower.cpp | 5 +++-- utils/libcecutil/cec-parse.cpp | 4 ++-- utils/v4l2-compliance/v4l2-compliance.cpp | 5 +++-- utils/v4l2-ctl/v4l2-ctl-common.cpp | 8 ++++---- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 5 +++-- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 7 ++++--- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 5 +++-- utils/v4l2-dbg/v4l2-dbg.cpp | 4 ++-- 10 files changed, 34 insertions(+), 27 deletions(-)
utils/cec-compliance/cec-test.cpp +3 -2
@@ -3,10 +3,11 @@ * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h>
@@ -1530,7 +1531,7 @@ void listTests() int setExpectedResult(char *optarg, bool no_warnings) { - char *equal = strchr(optarg, '='); + char *equal = std::strchr(optarg, '='); if (!equal || equal == optarg || !isdigit(equal[1])) return 1;
utils/cec-ctl/cec-ctl.cpp +7 -6
@@ -3,10 +3,11 @@ * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -1917,7 +1918,7 @@ int main(int argc, char **argv) case OptIgnore: { bool all_la = !strncmp(optarg, "all", 3); bool all_opcodes = true; - const char *sep = strchr(optarg, ','); + const char *sep = std::strchr(optarg, ','); unsigned la_mask = 0xffff, opcode, la = 0; if (sep)
@@ -2068,7 +2069,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++;
@@ -2109,7 +2110,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++;
@@ -2150,7 +2151,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++;
@@ -2184,7 +2185,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++;
utils/cec-follower/cec-follower.cpp +3 -2
@@ -3,10 +3,11 @@ * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -386,7 +387,7 @@ int main(int argc, char **argv) case OptIgnore: { bool all_la = !strncmp(optarg, "all", 3); bool all_opcodes = true; - const char *sep = strchr(optarg, ','); + const char *sep = std::strchr(optarg, ','); unsigned la_mask = 0xffff, opcode, la = 0; if (sep)
utils/libcecutil/cec-parse.cpp +2 -2
@@ -6,7 +6,6 @@ #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -18,6 +17,7 @@ #include <errno.h> #include <sys/ioctl.h> #include <stdarg.h> +#include <cstring> #include <ctime> #include <cerrno> #include <string>
@@ -191,7 +191,7 @@ unsigned cec_parse_phys_addr(const char *value) { unsigned p1, p2, p3, p4; - if (!strchr(value, '.')) + if (!std::strchr(value, '.')) return strtoul(value, NULL, 0); if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) { fprintf(stderr, "Expected a physical address of the form x.x.x.x\n");
utils/v4l2-compliance/v4l2-compliance.cpp +3 -2
@@ -18,10 +18,11 @@ Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -1580,7 +1581,7 @@ int main(int argc, char **argv) break; case OptStreamFrom: case OptStreamFromHdr: { - char *equal = strchr(optarg, '='); + char *equal = std::strchr(optarg, '='); bool has_hdr = ch == OptStreamFromHdr; if (equal == optarg)
utils/v4l2-ctl/v4l2-ctl-common.cpp +4 -4
@@ -1,7 +1,6 @@ #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -22,6 +21,7 @@ #include <sys/klog.h> #endif +#include <cstring> #include <list> #include <vector> #include <map>
@@ -741,7 +741,7 @@ static bool parse_subset(char *optarg) memset(&subset, 0, sizeof(subset)); while (*optarg) { - p = strchr(optarg, ','); + p = std::strchr(optarg, ','); if (p) *p = 0; if (optarg[0] == 0) {
@@ -808,7 +808,7 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) common_usage(); std::exit(EXIT_FAILURE); } - if (strchr(value, '=')) { + if (std::strchr(value, '=')) { common_usage(); std::exit(EXIT_FAILURE); }
@@ -824,7 +824,7 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) common_usage(); std::exit(EXIT_FAILURE); } - if (const char *equal = strchr(value, '=')) { + if (const char *equal = std::strchr(value, '=')) { set_ctrls[std::string(value, (equal - value))] = equal + 1; } else {
utils/v4l2-ctl/v4l2-ctl-edid.cpp +3 -2
@@ -1,7 +1,8 @@ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <fcntl.h> #include <ctype.h>
@@ -710,7 +711,7 @@ static unsigned short parse_phys_addr(const char *value) { unsigned p1, p2, p3, p4; - if (!strchr(value, '.')) + if (!std::strchr(value, '.')) return strtoul(value, NULL, 0); if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) { fprintf(stderr, "Expected a physical address of the form x.x.x.x\n");
utils/v4l2-ctl/v4l2-ctl-streaming.cpp +4 -3
@@ -1,7 +1,8 @@ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -1660,7 +1661,7 @@ static FILE *open_output_file(cv4l_fd &fd) if (!host_to) return NULL; - char *p = strchr(host_to, ':'); + char *p = std::strchr(host_to, ':'); struct sockaddr_in serv_addr; struct hostent *server; struct v4l2_fract aspect;
@@ -1925,7 +1926,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) if (!host_from) return NULL; - char *p = strchr(host_from, ':'); + char *p = std::strchr(host_from, ':'); int listen_fd; socklen_t clilen; struct sockaddr_in serv_addr = {}, cli_addr;
utils/v4l2-ctl/v4l2-ctl-vbi.cpp +3 -2
@@ -1,7 +1,8 @@ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -98,7 +99,7 @@ void vbi_cmd(int ch, char *optarg) std::exit(EXIT_FAILURE); } while (*optarg) { - subs = strchr(optarg, ','); + subs = std::strchr(optarg, ','); if (subs) *subs = 0;
utils/v4l2-dbg/v4l2-dbg.cpp +2 -2
@@ -19,7 +19,6 @@ #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -43,6 +42,7 @@ #include <linux/videodev2.h> +#include <cstring> #include <list> #include <vector> #include <map>
@@ -731,7 +731,7 @@ int main(int argc, char **argv) goto list_done; } - p = strchr(chip_info.name, ' '); + p = std::strchr(chip_info.name, ' '); if (p) *p = '\0'; name = chip_info.name;
Signature · 1 line
2.25.3
PATCH 2/7 utils: replace strrchr with std variant
--- utils/cec-ctl/cec-ctl.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-common.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
utils/cec-ctl/cec-ctl.cpp +1 -1
@@ -1651,7 +1651,7 @@ static void stress_test_power_cycle(struct node &node, unsigned cnt, static int calc_node_val(const char *s) { - s = strrchr(s, '/') + 1; + s = std::strrchr(s, '/') + 1; if (!memcmp(s, "cec", 3)) return atol(s + 3);
utils/v4l2-ctl/v4l2-ctl-common.cpp +1 -1
@@ -152,7 +152,7 @@ static int calc_node_val(const char *s) { int n = 0; - s = strrchr(s, '/') + 1; + s = std::strrchr(s, '/') + 1; for (unsigned i = 0; prefixes[i]; i++) { unsigned l = strlen(prefixes[i]);
Signature · 1 line
2.25.3
PATCH 3/7 utils: convert all is* functions to std
In reply to Rosen Penev--- utils/cec-compliance/cec-compliance.cpp | 6 +++--- utils/cec-compliance/cec-compliance.h | 2 +- utils/cec-compliance/cec-test.cpp | 2 +- utils/cec-ctl/cec-ctl.cpp | 4 ++-- utils/cec-follower/cec-follower.cpp | 2 +- utils/common/media-info.cpp | 4 ++-- utils/libcecutil/cec-info.cpp | 2 +- utils/libcecutil/cec-parse.cpp | 2 +- utils/rds-ctl/rds-ctl.cpp | 2 +- utils/v4l2-compliance/v4l2-compliance.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-common.cpp | 6 +++--- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-stds.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl.cpp | 8 ++++---- utils/v4l2-dbg/v4l2-dbg.cpp | 4 ++-- 16 files changed, 33 insertions(+), 33 deletions(-)
utils/cec-compliance/cec-compliance.cpp +3 -3
@@ -244,10 +244,10 @@ std::string safename(const char *name) bool not_alnum = false; while (*name) { - if (isalnum(*name)) { + if (std::isalnum(*name)) { if (not_alnum && !s.empty()) s += '-'; - s += tolower(*name); + s += std::tolower(*name); not_alnum = false; } else if (!not_alnum) not_alnum = true;
@@ -1158,7 +1158,7 @@ int main(int argc, char **argv) collectTests(); for (i = 0; long_options[i].name; i++) { - if (!isalpha(long_options[i].val)) + if (!std::isalpha(long_options[i].val)) continue; short_options[idx++] = long_options[i].val; if (long_options[i].has_arg == required_argument) {
utils/cec-compliance/cec-compliance.h +1 -1
@@ -293,7 +293,7 @@ static inline char get_yn() {char c; -while ((c =tolower (getchar ())) !='y' && c !='n' ); + while ((c = std::tolower(getchar())) != 'y' && c != 'n');getchar ();return c; }
utils/cec-compliance/cec-test.cpp +1 -1
@@ -1533,7 +1533,7 @@ int setExpectedResult(char *optarg, bool no_warnings) { char *equal = std::strchr(optarg, '='); - if (!equal || equal == optarg || !isdigit(equal[1])) + if (!equal || equal == optarg || !std::isdigit(equal[1])) return 1; *equal = 0; std::string name = safename(optarg);
utils/cec-ctl/cec-ctl.cpp +2 -2
@@ -1756,7 +1756,7 @@ static void list_devices() return; } while ((ep = readdir(dp))) - if (!memcmp(ep->d_name, "cec", 3) && isdigit(ep->d_name[3])) + if (!memcmp(ep->d_name, "cec", 3) && std::isdigit(ep->d_name[3])) files.push_back(std::string("/dev/") + ep->d_name); closedir(dp);
@@ -1859,7 +1859,7 @@ int main(int argc, char **argv) memset(phys_addrs, 0xff, sizeof(phys_addrs)); for (i = 0; long_options[i].name; i++) { - if (!isalpha(long_options[i].val)) + if (!std::isalpha(long_options[i].val)) continue; short_options[idx++] = long_options[i].val; if (long_options[i].has_arg == required_argument)
utils/cec-follower/cec-follower.cpp +1 -1
@@ -324,7 +324,7 @@ int main(int argc, char **argv) int i; for (i = 0; long_options[i].name; i++) { - if (!isalpha(long_options[i].val)) + if (!std::isalpha(long_options[i].val)) continue; short_options[idx++] = long_options[i].val; if (long_options[i].has_arg == required_argument) {
utils/common/media-info.cpp +2 -2
@@ -88,7 +88,7 @@ media_type mi_media_detect_type(const char *device) const char *devname = media_types[i].devname; size_t len = strlen(devname); - if (!line.compare(0, len, devname) && isdigit(line[0+len])) { + if (!line.compare(0, len, devname) && std::isdigit(line[0+len])) { uevent_file.close(); return media_types[i].type; }
@@ -220,7 +220,7 @@ int mi_get_media_fd(int fd, const char *bus_info) return -1; media_path[0] = 0; while ((ep = readdir(dp))) { - if (!memcmp(ep->d_name, "media", 5) && isdigit(ep->d_name[5])) { + if (!memcmp(ep->d_name, "media", 5) && std::isdigit(ep->d_name[5])) { struct media_device_info mdinfo; std::string devname("/dev/");
utils/libcecutil/cec-info.cpp +1 -1
@@ -498,7 +498,7 @@ std::string cec_device_find(const char *driver, const char *adapter) return name; } while ((ep = readdir(dp))) - if (!memcmp(ep->d_name, "cec", 3) && isdigit(ep->d_name[3])) { + if (!memcmp(ep->d_name, "cec", 3) && std::isdigit(ep->d_name[3])) { std::string devname("/dev/"); struct cec_caps caps; int fd;
utils/libcecutil/cec-parse.cpp +1 -1
@@ -178,7 +178,7 @@ int cec_parse_subopt(char **subs, const char * const *subopts, char **value) static unsigned parse_enum(const char *value, const struct cec_arg *a) { - if (isdigit(*value)) + if (std::isdigit(*value)) return strtoul(value, NULL, 0); for (int i = 0; i < a->num_enum_values; i++) { if (!strcmp(value, a->values[i].type_name))
utils/rds-ctl/rds-ctl.cpp +1 -1
@@ -751,7 +751,7 @@ static int parse_cl(int argc, char **argv) std::exit(EXIT_FAILURE); } for (i = 0; long_options[i].name; i++) { - if (!isalpha(long_options[i].val)) + if (!std::isalpha(long_options[i].val)) continue; short_options[idx++] = long_options[i].val; if (long_options[i].has_arg == required_argument)
utils/v4l2-compliance/v4l2-compliance.cpp +2 -2
@@ -835,7 +835,7 @@ static int open_media_bus_info(const std::string &bus_info, std::string &media_d while ((ep = readdir(dp))) { const char *name = ep->d_name; - if (!memcmp(name, "media", 5) && isdigit(name[5])) { + if (!memcmp(name, "media", 5) && std::isdigit(name[5])) { struct media_device_info mdi; media_devname = std::string("/dev/") + name;
@@ -1510,7 +1510,7 @@ int main(int argc, char **argv) } for (i = 0; long_options[i].name; i++) { - if (!isalpha(long_options[i].val)) + if (!std::isalpha(long_options[i].val)) continue; short_options[idx++] = long_options[i].val; if (long_options[i].has_arg == required_argument) {
utils/v4l2-ctl/v4l2-ctl-common.cpp +3 -3
@@ -141,7 +141,7 @@ static bool is_v4l_dev(const char *name) unsigned l = strlen(prefixes[i]); if (!memcmp(name, prefixes[i], l)) { - if (isdigit(name[l])) + if (std::isdigit(name[l])) return true; } }
@@ -339,11 +339,11 @@ static std::string name2var(const char *name) int add_underscore = 0; while (*name) { - if (isalnum(*name)) { + if (std::isalnum(*name)) { if (add_underscore) s += '_'; add_underscore = 0; - s += std::string(1, tolower(*name)); + s += std::string(1, std::tolower(*name)); } else if (s.length()) add_underscore = 1; name++;
utils/v4l2-ctl/v4l2-ctl-edid.cpp +1 -1
@@ -260,7 +260,7 @@ static void read_edid_file(FILE *f, struct v4l2_edid *e) /* Handle '0x' prefix */ if ((i & 1) && value[0] == '0' && (c == 'x' || c == 'X')) i--; - if (!isxdigit(c)) + if (!std::isxdigit(c)) continue; if (i & 0x01) { value[1] = c;
utils/v4l2-ctl/v4l2-ctl-stds.cpp +6 -6
@@ -79,7 +79,7 @@ void stds_usage() static v4l2_std_id parse_pal(const char *pal) { if (pal[0] == '-') { - switch (tolower(pal[1])) { + switch (std::tolower(pal[1])) { case '6': return V4L2_STD_PAL_60; case 'b':
@@ -88,7 +88,7 @@ static v4l2_std_id parse_pal(const char *pal) case 'h': return V4L2_STD_PAL_H; case 'n': - if (tolower(pal[2]) == 'c') + if (std::tolower(pal[2]) == 'c') return V4L2_STD_PAL_Nc; return V4L2_STD_PAL_N; case 'i':
@@ -108,7 +108,7 @@ static v4l2_std_id parse_pal(const char *pal) static v4l2_std_id parse_secam(const char *secam) { if (secam[0] == '-') { - switch (tolower(secam[1])) { + switch (std::tolower(secam[1])) { case 'b': case 'g': case 'h':
@@ -117,7 +117,7 @@ static v4l2_std_id parse_secam(const char *secam) case 'k': return V4L2_STD_SECAM_DK; case 'l': - if (tolower(secam[2]) == 'c') + if (std::tolower(secam[2]) == 'c') return V4L2_STD_SECAM_LC; return V4L2_STD_SECAM_L; }
@@ -130,7 +130,7 @@ static v4l2_std_id parse_secam(const char *secam) static v4l2_std_id parse_ntsc(const char *ntsc) { if (ntsc[0] == '-') { - switch (tolower(ntsc[1])) { + switch (std::tolower(ntsc[1])) { case 'm': return V4L2_STD_NTSC_M; case 'j':
@@ -459,7 +459,7 @@ void stds_cmd(int ch, char *optarg) else standard = V4L2_STD_SECAM; } - else if (isdigit(optarg[0])) { + else if (std::isdigit(optarg[0])) { standard = strtol(optarg, 0L, 0) | (1ULL << 63); } else { fprintf(stderr, "Unknown standard '%s'\n", optarg);
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +2 -2
@@ -123,7 +123,7 @@ void vidcap_cmd(int ch, char *optarg) optarg[2], optarg[3]); if (be_pixfmt) frmsize.pixel_format |= 1U << 31; - } else if (isdigit(optarg[0])) { + } else if (std::isdigit(optarg[0])) { frmsize.pixel_format = strtol(optarg, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg);
@@ -155,7 +155,7 @@ void vidcap_cmd(int ch, char *optarg) value[2], value[3]); if (be_pixfmt) frmival.pixel_format |= 1U << 31; - } else if (isdigit(optarg[0])) { + } else if (std::isdigit(optarg[0])) { frmival.pixel_format = strtol(value, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg);
utils/v4l2-ctl/v4l2-ctl.cpp +4 -4
@@ -791,7 +791,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat, value[2], value[3]); if (be_pixfmt) pixelformat |= 1U << 31; - } else if (isdigit(value[0])) { + } else if (std::isdigit(value[0])) { pixelformat = strtol(value, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", value);
@@ -926,7 +926,7 @@ static __u32 parse_event(const char *e, const char **name) __u32 event = 0; *name = "0"; - if (isdigit(e[0])) { + if (std::isdigit(e[0])) { event = strtoul(e, 0L, 0); if (event == V4L2_EVENT_CTRL) { fprintf(stderr, "Missing control name for ctrl event, use ctrl=<name>\n");
@@ -1008,7 +1008,7 @@ static int open_media_bus_info(const std::string &bus_info) while ((ep = readdir(dp))) { const char *name = ep->d_name; - if (!memcmp(name, "media", 5) && isdigit(name[5])) { + if (!memcmp(name, "media", 5) && std::isdigit(name[5])) { struct media_device_info mdi; std::string devname = std::string("/dev/") + name;
@@ -1135,7 +1135,7 @@ int main(int argc, char **argv) return 0; } for (i = 0; long_options[i].name; i++) { - if (!isalpha(long_options[i].val)) + if (!std::isalpha(long_options[i].val)) continue; short_options[idx++] = long_options[i].val; if (long_options[i].has_arg == required_argument) {
utils/v4l2-dbg/v4l2-dbg.cpp +2 -2
@@ -431,7 +431,7 @@ int main(int argc, char **argv) std::exit(EXIT_SUCCESS); } for (i = 0; long_options[i].name; i++) { - if (!isalpha(long_options[i].val)) + if (!std::isalpha(long_options[i].val)) continue; short_options[idx++] = long_options[i].val; if (long_options[i].has_arg == required_argument) {
@@ -479,7 +479,7 @@ int main(int argc, char **argv) break; case OptChip: - if (!memcmp(optarg, "subdev", 6) && isdigit(optarg[6])) { + if (!memcmp(optarg, "subdev", 6) && std::isdigit(optarg[6])) { match.type = V4L2_CHIP_MATCH_SUBDEV; match.addr = strtoul(optarg + 6, NULL, 0); break;
Signature · 1 line
2.25.3
PATCH 4/7 utils: convert all string to number functions to std
In reply to Rosen Penev--- utils/cec-compliance/cec-compliance.cpp | 6 +-- utils/cec-compliance/cec-test.cpp | 2 +- utils/cec-ctl/cec-ctl.cpp | 48 +++++++++++------------ utils/cec-follower/cec-follower.cpp | 4 +- utils/libcecutil/cec-parse.cpp | 6 +-- utils/rds-ctl/rds-ctl.cpp | 12 +++--- utils/v4l2-compliance/v4l2-compliance.cpp | 10 ++--- utils/v4l2-ctl/v4l2-ctl-common.cpp | 16 ++++---- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 22 +++++------ utils/v4l2-ctl/v4l2-ctl-io.cpp | 8 ++-- utils/v4l2-ctl/v4l2-ctl-meta.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-misc.cpp | 8 ++-- utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 32 +++++++-------- utils/v4l2-ctl/v4l2-ctl-sdr.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-selection.cpp | 16 ++++---- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 22 +++++------ utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 42 ++++++++++---------- utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 16 ++++---- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 14 +++---- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 8 ++-- utils/v4l2-ctl/v4l2-ctl.cpp | 22 +++++------ utils/v4l2-dbg/v4l2-dbg.cpp | 4 +- 22 files changed, 161 insertions(+), 161 deletions(-)
utils/cec-compliance/cec-compliance.cpp +3 -3
@@ -1210,10 +1210,10 @@ int main(int argc, char **argv) adapter = optarg; break; case OptReplyThreshold: - reply_threshold = strtoul(optarg, NULL, 0); + reply_threshold = std::strtoul(optarg, NULL, 0); break; case OptTimeout: - long_timeout = strtoul(optarg, NULL, 0); + long_timeout = std::strtoul(optarg, NULL, 0); break; case OptColor: if (!strcmp(optarg, "always"))
@@ -1246,7 +1246,7 @@ int main(int argc, char **argv) break; case OptRemote: if (optarg) { - remote_la = strtoul(optarg, NULL, 0); + remote_la = std::strtoul(optarg, NULL, 0); if (remote_la < 0 || remote_la > 15) { fprintf(stderr, "--test: invalid remote logical address\n"); usage();
utils/cec-compliance/cec-test.cpp +1 -1
@@ -1539,7 +1539,7 @@ int setExpectedResult(char *optarg, bool no_warnings) std::string name = safename(optarg); if (mapTests.find(name) == mapTests.end()) return 1; - mapTests[name] = strtoul(equal + 1, NULL, 0); + mapTests[name] = std::strtoul(equal + 1, NULL, 0); mapTestsNoWarnings[name] = no_warnings; return 0; }
utils/cec-ctl/cec-ctl.cpp +24 -24
146 lines not on this page · raw message
utils/cec-follower/cec-follower.cpp +2 -2
@@ -393,7 +393,7 @@ int main(int argc, char **argv) if (sep) all_opcodes = !strncmp(sep + 1, "all", 3); if (!all_la) { - la = strtoul(optarg, NULL, 0); + la = std::strtoul(optarg, NULL, 0); if (la > 15) { fprintf(stderr, "invalid logical address (> 15)\n");
@@ -403,7 +403,7 @@ int main(int argc, char **argv) la_mask = 1 << la; } if (!all_opcodes) { - opcode = strtoul(sep + 1, NULL, 0); + opcode = std::strtoul(sep + 1, NULL, 0); if (opcode > 255) { fprintf(stderr, "invalid opcode (> 255)\n"); usage();
utils/libcecutil/cec-parse.cpp +3 -3
@@ -179,7 +179,7 @@ int cec_parse_subopt(char **subs, const char * const *subopts, char **value) static unsigned parse_enum(const char *value, const struct cec_arg *a) { if (std::isdigit(*value)) - return strtoul(value, NULL, 0); + return std::strtoul(value, NULL, 0); for (int i = 0; i < a->num_enum_values; i++) { if (!strcmp(value, a->values[i].type_name)) return a->values[i].value;
@@ -192,7 +192,7 @@ unsigned cec_parse_phys_addr(const char *value) unsigned p1, p2, p3, p4; if (!std::strchr(value, '.')) - return strtoul(value, NULL, 0); + return std::strtoul(value, NULL, 0); if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) { fprintf(stderr, "Expected a physical address of the form x.x.x.x\n"); return 0;
@@ -207,7 +207,7 @@ unsigned cec_parse_phys_addr(const char *value) static unsigned parse_latency(const char *value) { char *end; - unsigned delay = strtoul(value, &end, 0); + unsigned delay = std::strtoul(value, &end, 0); if (!memcmp(end, "ms", 2)) delay = (delay / 2) + 1;
utils/rds-ctl/rds-ctl.cpp +6 -6
@@ -404,13 +404,13 @@ static void parse_freq_seek(char *optarg, struct v4l2_hw_freq_seek &seek) switch (parse_subopt(&subs, subopts, &value)) { case 0: - seek.seek_upward = strtol(value, 0L, 0); + seek.seek_upward = std::strtol(value, 0L, 0); break; case 1: - seek.wrap_around = strtol(value, 0L, 0); + seek.wrap_around = std::strtol(value, 0L, 0); break; case 2: - seek.spacing = strtol(value, 0L, 0); + seek.spacing = std::strtol(value, 0L, 0); break; default: usage_tuner();
@@ -776,7 +776,7 @@ static int parse_cl(int argc, char **argv) params.fd_name[sizeof(params.fd_name) - 1] = '\0'; break; case OptSetFreq: - params.freq = strtod(optarg, NULL); + params.freq = std::strtod(optarg, NULL); break; case OptListDevices: print_devices(list_devices());
@@ -785,7 +785,7 @@ static int parse_cl(int argc, char **argv) parse_freq_seek(optarg, params.freq_seek); break; case OptTunerIndex: - params.tuner_index = strtoul(optarg, NULL, 0); + params.tuner_index = std::strtoul(optarg, NULL, 0); break; case OptOpenFile: {
@@ -802,7 +802,7 @@ static int parse_cl(int argc, char **argv) break; } case OptWaitLimit: - params.wait_limit = strtoul(optarg, NULL, 0); + params.wait_limit = std::strtoul(optarg, NULL, 0); break; case ':': fprintf(stderr, "Option '%s' requires a value\n",
utils/v4l2-compliance/v4l2-compliance.cpp +5 -5
@@ -897,7 +897,7 @@ static std::string make_devname(const char *device, const char *devname, goto err; if (device[0] == '0' && device[1] == 'x') - iface_id = strtoul(device, NULL, 16); + iface_id = std::strtoul(device, NULL, 16); if (!iface_id) { for (i = 0; i < topology.num_entities; i++)
@@ -1577,7 +1577,7 @@ int main(int argc, char **argv) break; case OptStreaming: if (optarg) - frame_count = strtoul(optarg, NULL, 0); + frame_count = std::strtoul(optarg, NULL, 0); break; case OptStreamFrom: case OptStreamFromHdr: {
@@ -1598,7 +1598,7 @@ int main(int argc, char **argv) } case OptStreamAllFormats: if (optarg) - all_fmt_frame_count = strtoul(optarg, NULL, 0); + all_fmt_frame_count = std::strtoul(optarg, NULL, 0); break; case OptStreamAllColorTest: subs = optarg;
@@ -1624,10 +1624,10 @@ int main(int argc, char **argv) } break; case 1: - color_skip = strtoul(value, 0L, 0); + color_skip = std::strtoul(value, 0L, 0); break; case 2: - color_perc = strtoul(value, 0L, 0); + color_perc = std::strtoul(value, 0L, 0); if (color_perc == 0) color_perc = 90; if (color_perc > 100)
utils/v4l2-ctl/v4l2-ctl-common.cpp +8 -8
@@ -159,7 +159,7 @@ static int calc_node_val(const char *s) if (!memcmp(s, prefixes[i], l)) { n = i << 8; - n += atol(s + l); + n += std::atol(s + l); return n; } }
@@ -756,9 +756,9 @@ static bool parse_subset(char *optarg) return true; } if (idx & 1) - subset.offset[idx / 2] = strtoul(optarg, 0, 0); + subset.offset[idx / 2] = std::strtoul(optarg, 0, 0); else { - subset.size[idx / 2 - 1] = strtoul(optarg, 0, 0); + subset.size[idx / 2 - 1] = std::strtoul(optarg, 0, 0); if (subset.size[idx / 2 - 1] == 0) { fprintf(stderr, "<size> cannot be 0\n"); return true;
@@ -840,7 +840,7 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) } break; case OptSetPriority: - prio = static_cast<enum v4l2_priority>(strtoul(optarg, 0L, 0)); + prio = static_cast<enum v4l2_priority>(std::strtoul(optarg, 0L, 0)); break; case OptListDevices: if (media_bus_info.empty())
@@ -952,19 +952,19 @@ void common_set(cv4l_fd &_fd) switch (qc.type) { case V4L2_CTRL_TYPE_U8: - v = strtoul(iter->second.c_str(), NULL, 0); + v = std::strtoul(iter->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 = std::strtoul(iter->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 = std::strtoul(iter->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;
@@ -985,7 +985,7 @@ 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 = std::strtol(iter->second.c_str(), NULL, 0); } class2ctrls[V4L2_CTRL_ID2WHICH(ctrl.id)].push_back(ctrl); }
utils/v4l2-ctl/v4l2-ctl-edid.cpp +11 -11
@@ -266,7 +266,7 @@ static void read_edid_file(FILE *f, struct v4l2_edid *e) value[1] = c; if (i % 256 == 1) edid_add_block(e); - e->edid[i / 2] = strtoul(value, 0, 16); + e->edid[i / 2] = std::strtoul(value, 0, 16); } else { value[0] = c; }
@@ -712,7 +712,7 @@ static unsigned short parse_phys_addr(const char *value) unsigned p1, p2, p3, p4; if (!std::strchr(value, '.')) - return strtoul(value, NULL, 0); + return std::strtoul(value, NULL, 0); if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) { fprintf(stderr, "Expected a physical address of the form x.x.x.x\n"); return 0xffff;
@@ -997,7 +997,7 @@ void edid_cmd(int ch, char *optarg) } switch (opt) { case 0: - sedid.pad = strtoul(value, 0, 0); + sedid.pad = std::strtoul(value, 0, 0); break; case 1: case 2: /* keep edid for compat reasons, it's the same as type */
@@ -1052,13 +1052,13 @@ void edid_cmd(int ch, char *optarg) phys_addr = parse_phys_addr(value); break; case 6: - mod_s_pt = strtoul(value, 0, 0) & 3; + mod_s_pt = std::strtoul(value, 0, 0) & 3; break; case 7: - mod_s_it = strtoul(value, 0, 0) & 3; + mod_s_it = std::strtoul(value, 0, 0) & 3; break; case 8: - mod_s_ce = strtoul(value, 0, 0) & 3; + mod_s_ce = std::strtoul(value, 0, 0) & 3; break; case 9: toggle_hdmi_vsdb_dc_flags |= HDMI_VSDB_Y444_BIT; break; case 10: toggle_hdmi_vsdb_dc_flags |= HDMI_VSDB_30_BIT; break;
@@ -1117,7 +1117,7 @@ void edid_cmd(int ch, char *optarg) case OptClearEdid: if (optarg) - clear_pad = strtoul(optarg, 0, 0); + clear_pad = std::strtoul(optarg, 0, 0); break; case OptGetEdid:
@@ -1140,17 +1140,17 @@ void edid_cmd(int ch, char *optarg) switch (parse_subopt(&subs, subopts, &value)) { case 0: - gedid.pad = strtoul(value, 0, 0); + gedid.pad = std::strtoul(value, 0, 0); break; case 1: - gedid.start_block = strtoul(value, 0, 0); + gedid.start_block = std::strtoul(value, 0, 0); if (gedid.start_block > 255) { fprintf(stderr, "startblock %d too large, max 255\n", gedid.start_block); std::exit(EXIT_FAILURE); } break; case 2: - gedid.blocks = strtoul(value, 0, 0); + gedid.blocks = std::strtoul(value, 0, 0); break; case 3: if (!strcmp(value, "hex")) {
@@ -1180,7 +1180,7 @@ void edid_cmd(int ch, char *optarg) case OptInfoEdid: memset(&info_edid, 0, sizeof(info_edid)); if (optarg) - info_edid.pad = strtoul(optarg, 0, 0); + info_edid.pad = std::strtoul(optarg, 0, 0); break; } }
utils/v4l2-ctl/v4l2-ctl-io.cpp +4 -4
@@ -79,16 +79,16 @@ void io_cmd(int ch, char *optarg) { switch (ch) { case OptSetInput: - input = strtol(optarg, 0L, 0); + input = std::strtol(optarg, 0L, 0); break; case OptSetOutput: - output = strtol(optarg, 0L, 0); + output = std::strtol(optarg, 0L, 0); break; case OptSetAudioInput: - vaudio.index = strtol(optarg, 0L, 0); + vaudio.index = std::strtol(optarg, 0L, 0); break; case OptSetAudioOutput: - vaudout.index = strtol(optarg, 0L, 0); + vaudout.index = std::strtol(optarg, 0L, 0); break; } }
utils/v4l2-ctl/v4l2-ctl-meta.cpp +1 -1
@@ -54,7 +54,7 @@ void meta_cmd(int ch, char *optarg) vfmt.fmt.meta.dataformat = v4l2_fourcc(optarg[0], optarg[1], optarg[2], optarg[3]); } else { - vfmt.fmt.meta.dataformat = strtol(optarg, 0L, 0); + vfmt.fmt.meta.dataformat = std::strtol(optarg, 0L, 0); } break; }
utils/v4l2-ctl/v4l2-ctl-misc.cpp +4 -4
@@ -186,10 +186,10 @@ void misc_cmd(int ch, char *optarg) switch (ch) { case OptSetParm: - fps = strtod(optarg, NULL); + fps = std::strtod(optarg, NULL); break; case OptSetOutputParm: - output_fps = strtod(optarg, NULL); + output_fps = std::strtod(optarg, NULL); break; case OptSetJpegComp: subs = optarg;
@@ -209,7 +209,7 @@ void misc_cmd(int ch, char *optarg) switch (opt) { case 16: - jpegcomp.quality = strtol(value, 0L, 0); + jpegcomp.quality = std::strtol(value, 0L, 0); break; case 17: if (strstr(value, "dht"))
@@ -294,7 +294,7 @@ void misc_cmd(int ch, char *optarg) dec_cmd.stop.pts = strtoull(value, 0, 0); break; case 3: - dec_cmd.start.speed = strtol(value, 0, 0); + dec_cmd.start.speed = std::strtol(value, 0, 0); break; case 4: if (!strcmp(value, "gop"))
utils/v4l2-ctl/v4l2-ctl-overlay.cpp +16 -16
@@ -239,27 +239,27 @@ void overlay_cmd(int ch, char *optarg) switch (parse_subopt(&subs, subopts, &value)) { case 0: - overlay_fmt.fmt.win.chromakey = strtoul(value, 0L, 0); + overlay_fmt.fmt.win.chromakey = std::strtoul(value, 0L, 0); set_overlay_fmt |= FmtChromaKey; break; case 1: - overlay_fmt.fmt.win.global_alpha = strtoul(value, 0L, 0); + overlay_fmt.fmt.win.global_alpha = std::strtoul(value, 0L, 0); set_overlay_fmt |= FmtGlobalAlpha; break; case 2: - overlay_fmt.fmt.win.w.left = strtol(value, 0L, 0); + overlay_fmt.fmt.win.w.left = std::strtol(value, 0L, 0); set_overlay_fmt |= FmtLeft; break; case 3: - overlay_fmt.fmt.win.w.top = strtol(value, 0L, 0); + overlay_fmt.fmt.win.w.top = std::strtol(value, 0L, 0); set_overlay_fmt |= FmtTop; break; case 4: - overlay_fmt.fmt.win.w.width = strtoul(value, 0L, 0); + overlay_fmt.fmt.win.w.width = std::strtoul(value, 0L, 0); set_overlay_fmt |= FmtWidth; break; case 5: - overlay_fmt.fmt.win.w.height = strtoul(value, 0L, 0); + overlay_fmt.fmt.win.w.height = std::strtoul(value, 0L, 0); set_overlay_fmt |= FmtHeight; break; case 6:
@@ -287,16 +287,16 @@ void overlay_cmd(int ch, char *optarg) switch (parse_subopt(&subs, subopts, &value)) { case 0: - r.left = strtoul(value, 0L, 0); + r.left = std::strtoul(value, 0L, 0); break; case 1: - r.top = strtoul(value, 0L, 0); + r.top = std::strtoul(value, 0L, 0); break; case 2: - r.width = strtoul(value, 0L, 0); + r.width = std::strtoul(value, 0L, 0); break; case 3: - r.height = strtoul(value, 0L, 0); + r.height = std::strtoul(value, 0L, 0); break; default: overlay_usage();
@@ -338,27 +338,27 @@ void overlay_cmd(int ch, char *optarg) switch (parse_subopt(&subs, subopts, &value)) { case 0: fbuf.flags &= ~chroma_flags; - fbuf.flags |= strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_CHROMAKEY : 0; + fbuf.flags |= std::strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_CHROMAKEY : 0; set_fbuf |= chroma_flags; break; case 1: fbuf.flags &= ~chroma_flags; - fbuf.flags |= strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_SRC_CHROMAKEY : 0; + fbuf.flags |= std::strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_SRC_CHROMAKEY : 0; set_fbuf |= chroma_flags; break; case 2: fbuf.flags &= ~alpha_flags; - fbuf.flags |= strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_GLOBAL_ALPHA : 0; + fbuf.flags |= std::strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_GLOBAL_ALPHA : 0; set_fbuf |= alpha_flags; break; case 3: fbuf.flags &= ~alpha_flags; - fbuf.flags |= strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_LOCAL_ALPHA : 0; + fbuf.flags |= std::strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_LOCAL_ALPHA : 0; set_fbuf |= alpha_flags; break; case 4: fbuf.flags &= ~alpha_flags; - fbuf.flags |= strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_LOCAL_INV_ALPHA : 0; + fbuf.flags |= std::strtol(value, 0L, 0) ? V4L2_FBUF_FLAG_LOCAL_INV_ALPHA : 0; set_fbuf |= alpha_flags; break; case 5:
@@ -377,7 +377,7 @@ void overlay_cmd(int ch, char *optarg) } break; case OptOverlay: - overlay = strtol(optarg, 0L, 0); + overlay = std::strtol(optarg, 0L, 0); break; } }
utils/v4l2-ctl/v4l2-ctl-sdr.cpp +1 -1
@@ -57,7 +57,7 @@ void sdr_cmd(int ch, char *optarg) vfmt.fmt.sdr.pixelformat = v4l2_fourcc(optarg[0], optarg[1], optarg[2], optarg[3]); } else { - vfmt.fmt.sdr.pixelformat = strtol(optarg, 0L, 0); + vfmt.fmt.sdr.pixelformat = std::strtol(optarg, 0L, 0); } break; }
utils/v4l2-ctl/v4l2-ctl-selection.cpp +8 -8
@@ -119,19 +119,19 @@ static void parse_crop(char *optarg, unsigned int &set_crop, v4l2_rect &vcrop) switch (parse_subopt(&subs, subopts, &value)) { case 0: - vcrop.left = strtol(value, 0L, 0); + vcrop.left = std::strtol(value, 0L, 0); set_crop |= CropLeft; break; case 1: - vcrop.top = strtol(value, 0L, 0); + vcrop.top = std::strtol(value, 0L, 0); set_crop |= CropTop; break; case 2: - vcrop.width = strtol(value, 0L, 0); + vcrop.width = std::strtol(value, 0L, 0); set_crop |= CropWidth; break; case 3: - vcrop.height = strtol(value, 0L, 0); + vcrop.height = std::strtol(value, 0L, 0); set_crop |= CropHeight; break; default:
@@ -192,19 +192,19 @@ static int parse_selection(char *optarg, unsigned int &set_sel, v4l2_selection & set_sel |= SelectionFlags; break; case 2: - vsel.r.left = strtol(value, 0L, 0); + vsel.r.left = std::strtol(value, 0L, 0); set_sel |= SelectionLeft; break; case 3: - vsel.r.top = strtol(value, 0L, 0); + vsel.r.top = std::strtol(value, 0L, 0); set_sel |= SelectionTop; break; case 4: - vsel.r.width = strtoul(value, 0L, 0); + vsel.r.width = std::strtoul(value, 0L, 0); set_sel |= SelectionWidth; break; case 5: - vsel.r.height = strtoul(value, 0L, 0); + vsel.r.height = std::strtoul(value, 0L, 0); set_sel |= SelectionHeight; break; default:
utils/v4l2-ctl/v4l2-ctl-streaming.cpp +11 -11
@@ -652,13 +652,13 @@ void streaming_cmd(int ch, char *optarg) switch (ch) { case OptStreamCount: - stream_count = strtoul(optarg, 0L, 0); + stream_count = std::strtoul(optarg, 0L, 0); break; case OptStreamSkip: - stream_skip = strtoul(optarg, 0L, 0); + stream_skip = std::strtoul(optarg, 0L, 0); break; case OptStreamSleep: - stream_sleep = strtol(optarg, 0L, 0); + stream_sleep = std::strtol(optarg, 0L, 0); break; case OptStreamNoQuery: stream_no_query = true;
@@ -667,7 +667,7 @@ void streaming_cmd(int ch, char *optarg) stream_loop = true; break; case OptStreamOutPattern: - stream_pat = strtoul(optarg, 0L, 0); + stream_pat = std::strtoul(optarg, 0L, 0); for (i = 0; tpg_pattern_strings[i]; i++) ; if (stream_pat >= i) stream_pat = 0;
@@ -707,7 +707,7 @@ void streaming_cmd(int ch, char *optarg) streaming_usage(); break; case OptStreamOutAlphaComponent: - stream_out_alpha = strtoul(optarg, 0L, 0); + stream_out_alpha = std::strtoul(optarg, 0L, 0); break; case OptStreamOutAlphaRedOnly: stream_out_alpha_red_only = true;
@@ -717,7 +717,7 @@ void streaming_cmd(int ch, char *optarg) break; case OptStreamOutHorSpeed: case OptStreamOutVertSpeed: - speed = strtol(optarg, 0L, 0); + speed = std::strtol(optarg, 0L, 0); if (speed < -3) speed = -3; if (speed > 3)
@@ -728,7 +728,7 @@ void streaming_cmd(int ch, char *optarg) stream_out_vert_mode = static_cast<tpg_move_mode>(speed + 3); break; case OptStreamOutPercFill: - stream_out_perc_fill = strtoul(optarg, 0L, 0); + stream_out_perc_fill = std::strtoul(optarg, 0L, 0); if (stream_out_perc_fill > 100) stream_out_perc_fill = 100; if (stream_out_perc_fill < 1)
@@ -768,7 +768,7 @@ void streaming_cmd(int ch, char *optarg) fallthrough; case OptStreamMmap: if (optarg) { - reqbufs_count_cap = strtoul(optarg, 0L, 0); + reqbufs_count_cap = std::strtoul(optarg, 0L, 0); if (reqbufs_count_cap == 0) reqbufs_count_cap = 3; }
@@ -781,7 +781,7 @@ void streaming_cmd(int ch, char *optarg) fallthrough; case OptStreamOutMmap: if (optarg) { - reqbufs_count_out = strtoul(optarg, 0L, 0); + reqbufs_count_out = std::strtoul(optarg, 0L, 0); if (reqbufs_count_out == 0) reqbufs_count_out = 3; }
@@ -1672,7 +1672,7 @@ static FILE *open_output_file(cv4l_fd &fd) aspect = fd.g_pixel_aspect(width, height); if (p) { - host_port_to = strtoul(p + 1, 0L, 0); + host_port_to = std::strtoul(p + 1, 0L, 0); *p = '\0'; } host_fd_to = socket(AF_INET, SOCK_STREAM, 0);
@@ -1932,7 +1932,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) struct sockaddr_in serv_addr = {}, cli_addr; if (p) { - host_port_from = strtoul(p + 1, 0L, 0); + host_port_from = std::strtoul(p + 1, 0L, 0); *p = '\0'; } listen_fd = socket(AF_INET, SOCK_STREAM, 0);
utils/v4l2-ctl/v4l2-ctl-subdev.cpp +21 -21
130 lines not on this page · raw message
utils/v4l2-ctl/v4l2-ctl-tuner.cpp +8 -8
@@ -182,19 +182,19 @@ static void parse_freq_seek(char *optarg, struct v4l2_hw_freq_seek &seek) switch (parse_subopt(&subs, subopts, &value)) { case 0: - seek.seek_upward = strtol(value, 0L, 0); + seek.seek_upward = std::strtol(value, 0L, 0); break; case 1: - seek.wrap_around = strtol(value, 0L, 0); + seek.wrap_around = std::strtol(value, 0L, 0); break; case 2: - seek.spacing = strtol(value, 0L, 0); + seek.spacing = std::strtol(value, 0L, 0); break; case 3: - low = strtod(value, NULL); + low = std::strtod(value, NULL); break; case 4: - high = strtod(value, NULL); + high = std::strtod(value, NULL); break; default: tuner_usage();
@@ -207,7 +207,7 @@ void tuner_cmd(int ch, char *optarg) { switch (ch) { case OptSetFreq: - freq = strtod(optarg, NULL); + freq = std::strtod(optarg, NULL); break; case OptSetTuner: if (!strcmp(optarg, "stereo"))
@@ -227,7 +227,7 @@ void tuner_cmd(int ch, char *optarg) } break; case OptSetModulator: - txsubchans = strtol(optarg, 0L, 0); + txsubchans = std::strtol(optarg, 0L, 0); if (!strcmp(optarg, "stereo")) txsubchans = V4L2_TUNER_SUB_STEREO; else if (!strcmp(optarg, "stereo-sap"))
@@ -252,7 +252,7 @@ void tuner_cmd(int ch, char *optarg) parse_freq_seek(optarg, freq_seek); break; case OptTunerIndex: - tuner_index = strtoul(optarg, NULL, 0); + tuner_index = std::strtoul(optarg, NULL, 0); break; } }
utils/v4l2-ctl/v4l2-ctl-vbi.cpp +7 -7
@@ -151,25 +151,25 @@ void vbi_cmd(int ch, char *optarg) switch (parse_subopt(&subs, subopts, &value)) { case 0: - raw->fmt.vbi.sampling_rate = strtoul(value, NULL, 0); + raw->fmt.vbi.sampling_rate = std::strtoul(value, NULL, 0); break; case 1: - raw->fmt.vbi.offset = strtoul(value, NULL, 0); + raw->fmt.vbi.offset = std::strtoul(value, NULL, 0); break; case 2: - raw->fmt.vbi.samples_per_line = strtoul(value, NULL, 0); + raw->fmt.vbi.samples_per_line = std::strtoul(value, NULL, 0); break; case 3: - raw->fmt.vbi.start[0] = strtoul(value, NULL, 0); + raw->fmt.vbi.start[0] = std::strtoul(value, NULL, 0); break; case 4: - raw->fmt.vbi.start[1] = strtoul(value, NULL, 0); + raw->fmt.vbi.start[1] = std::strtoul(value, NULL, 0); break; case 5: - raw->fmt.vbi.count[0] = strtoul(value, NULL, 0); + raw->fmt.vbi.count[0] = std::strtoul(value, NULL, 0); break; case 6: - raw->fmt.vbi.count[1] = strtoul(value, NULL, 0); + raw->fmt.vbi.count[1] = std::strtoul(value, NULL, 0); break; default: vbi_usage();
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +4 -4
@@ -124,7 +124,7 @@ void vidcap_cmd(int ch, char *optarg) if (be_pixfmt) frmsize.pixel_format |= 1U << 31; } else if (std::isdigit(optarg[0])) { - frmsize.pixel_format = strtol(optarg, 0L, 0); + frmsize.pixel_format = std::strtol(optarg, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg); std::exit(EXIT_FAILURE);
@@ -142,10 +142,10 @@ void vidcap_cmd(int ch, char *optarg) switch (parse_subopt(&subs, subopts, &value)) { case 0: - frmival.width = strtol(value, 0L, 0); + frmival.width = std::strtol(value, 0L, 0); break; case 1: - frmival.height = strtol(value, 0L, 0); + frmival.height = std::strtol(value, 0L, 0); break; case 2: be_pixfmt = strlen(value) == 7 && !memcmp(value + 4, "-BE", 3);
@@ -156,7 +156,7 @@ void vidcap_cmd(int ch, char *optarg) if (be_pixfmt) frmival.pixel_format |= 1U << 31; } else if (std::isdigit(optarg[0])) { - frmival.pixel_format = strtol(value, 0L, 0); + frmival.pixel_format = std::strtol(value, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg); std::exit(EXIT_FAILURE);
utils/v4l2-ctl/v4l2-ctl.cpp +11 -11
@@ -776,11 +776,11 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat, switch (parse_subopt(&subs, subopts, &value)) { case 0: - width = strtoul(value, 0L, 0); + width = std::strtoul(value, 0L, 0); fmts |= FmtWidth; break; case 1: - height = strtoul(value, 0L, 0); + height = std::strtoul(value, 0L, 0); fmts |= FmtHeight; break; case 2:
@@ -792,7 +792,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat, if (be_pixfmt) pixelformat |= 1U << 31; } else if (std::isdigit(value[0])) { - pixelformat = strtol(value, 0L, 0); + pixelformat = std::strtol(value, 0L, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", value); std::exit(EXIT_FAILURE);
@@ -819,7 +819,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat, fmts |= FmtYCbCr; break; case 7: - bytesperline[bpl_index] = strtoul(value, 0L, 0); + bytesperline[bpl_index] = std::strtoul(value, 0L, 0); if (bytesperline[bpl_index] > 0xffff) { fprintf(stderr, "bytesperline can't be more than 65535\n"); bytesperline[bpl_index] = 0;
@@ -840,7 +840,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat, fmts |= FmtXferFunc; break; case 11: - sizeimage[sizeimage_index] = strtoul(value, 0L, 0); + sizeimage[sizeimage_index] = std::strtoul(value, 0L, 0); sizeimage_index++; fmts |= FmtSizeImage; break;
@@ -927,7 +927,7 @@ static __u32 parse_event(const char *e, const char **name) *name = "0"; if (std::isdigit(e[0])) { - event = strtoul(e, 0L, 0); + event = std::strtoul(e, 0L, 0); if (event == V4L2_EVENT_CTRL) { fprintf(stderr, "Missing control name for ctrl event, use ctrl=<name>\n"); misc_usage();
@@ -1062,7 +1062,7 @@ static const char *make_devname(const char *device, const char *devname, goto err; if (device[0] == '0' && device[1] == 'x') - iface_id = strtoul(device, NULL, 16); + iface_id = std::strtoul(device, NULL, 16); if (!iface_id) { for (i = 0; i < topology.num_entities; i++)
@@ -1244,7 +1244,7 @@ int main(int argc, char **argv) return 1; break; case OptSleep: - secs = strtoul(optarg, 0L, 0); + secs = std::strtoul(optarg, 0L, 0); break; case ':': fprintf(stderr, "Option '%s' requires a value\n",
@@ -1509,7 +1509,7 @@ int main(int argc, char **argv) if (wait_for_event == V4L2_EVENT_CTRL) sub.id = common_find_ctrl_id(wait_event_id); else if (wait_for_event == V4L2_EVENT_SOURCE_CHANGE) - sub.id = strtoul(wait_event_id, 0L, 0); + sub.id = std::strtoul(wait_event_id, 0L, 0); if (!doioctl(fd, VIDIOC_SUBSCRIBE_EVENT, &sub)) if (!doioctl(fd, VIDIOC_DQEVENT, &ev)) print_event(&ev);
@@ -1525,7 +1525,7 @@ int main(int argc, char **argv) if (poll_for_event == V4L2_EVENT_CTRL) sub.id = common_find_ctrl_id(poll_event_id); else if (poll_for_event == V4L2_EVENT_SOURCE_CHANGE) - sub.id = strtoul(poll_event_id, 0L, 0); + sub.id = std::strtoul(poll_event_id, 0L, 0); if (!doioctl(fd, VIDIOC_SUBSCRIBE_EVENT, &sub)) { fd_set fds; __u32 seq = 0;
@@ -1566,7 +1566,7 @@ int main(int argc, char **argv) if (epoll_for_event == V4L2_EVENT_CTRL) sub.id = common_find_ctrl_id(epoll_event_id); else if (epoll_for_event == V4L2_EVENT_SOURCE_CHANGE) - sub.id = strtoul(epoll_event_id, 0L, 0); + sub.id = std::strtoul(epoll_event_id, 0L, 0); if (!doioctl(fd, VIDIOC_SUBSCRIBE_EVENT, &sub)) { __u32 seq = 0;
utils/v4l2-dbg/v4l2-dbg.cpp +2 -2
@@ -481,12 +481,12 @@ int main(int argc, char **argv) case OptChip: if (!memcmp(optarg, "subdev", 6) && std::isdigit(optarg[6])) { match.type = V4L2_CHIP_MATCH_SUBDEV; - match.addr = strtoul(optarg + 6, NULL, 0); + match.addr = std::strtoul(optarg + 6, NULL, 0); break; } if (!memcmp(optarg, "bridge", 6)) { match.type = V4L2_CHIP_MATCH_BRIDGE; - match.addr = strtoul(optarg + 6, NULL, 0); + match.addr = std::strtoul(optarg + 6, NULL, 0); break; } match.type = V4L2_CHIP_MATCH_BRIDGE;
Signature · 1 line
2.25.3
PATCH 5/7 v4l-utils: fix compilation with libcxx
In reply to Rosen PenevThe fallthrough define doesn't work properly there. Use the included macro.
--- include/compiler.h | 5 +++++ 1 file changed, 5 insertions(+)
include/compiler.h +5 -0
@@ -1,5 +1,9 @@#ifdef __cplusplus +#ifdef _LIBCPP_VERSION +#define fallthrough _LIBCPP_FALLTHROUGH() +#else +#ifdef __clang__#define fallthrough [[clang::fallthrough]]#else
@@ -7,3 +11,4 @@#endif #endif +#endif
Signature · 1 line
2.25.3
PATCH 6/7 compiler: fix compilation with clang + std=c++98 + glibcxx
In reply to Rosen PenevIt seems clang does not like these attributes in c++98 mode.
--- include/compiler.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
include/compiler.h +8 -5
@@ -1,14 +1,17 @@ -#ifdef __cplusplus -#ifdef _LIBCPP_VERSION#define fallthrough _LIBCPP_FALLTHROUGH()#else +#if __cplusplus >=201103L +#ifdef __clang__#define fallthrough [[clang::fallthrough]]#else #define fallthrough [[gnu::fallthrough]] -#endif +#endif // __clang__ + +#else +#define fallthrough ((void)0) -#endif -#endif +#endif // __cplusplus +#endif // _LIBCPP_VERSION
Signature · 1 line
2.25.3
PATCH 7/7 utils: switch C to C++ headers
In reply to Rosen PenevRecently, I changed exit() to the std variant, which caused build failures on older platforms. Switch all headers to the C++ variants to avoid this.
These C headers are deprecated by C++14.
--- utils/cec-compliance/cec-compliance.cpp | 10 +++++----- utils/cec-compliance/cec-test-adapter.cpp | 10 +++++----- utils/cec-compliance/cec-test-audio.cpp | 10 +++++----- utils/cec-compliance/cec-test-fuzzing.cpp | 10 +++++----- utils/cec-compliance/cec-test-power.cpp | 10 +++++----- utils/cec-compliance/cec-test.cpp | 8 ++++---- utils/cec-ctl/cec-ctl.cpp | 10 +++++----- utils/cec-ctl/cec-pin.cpp | 12 ++++++------ utils/cec-follower/cec-follower.cpp | 8 ++++---- utils/cec-follower/cec-processing.cpp | 10 +++++----- utils/cec-follower/cec-tuner.cpp | 2 +- utils/common/media-info.cpp | 10 +++++----- utils/common/v4l2-info.cpp | 10 +++++----- utils/libcecutil/cec-info.cpp | 2 +- utils/libcecutil/cec-log.cpp | 8 ++++---- utils/libcecutil/cec-parse.cpp | 10 +++++----- utils/rds-ctl/rds-ctl.cpp | 14 +++++++------- utils/v4l2-compliance/v4l2-compliance.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-buffers.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-codecs.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-colors.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-controls.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-debug.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-formats.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-input-output.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-io-config.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-media.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-subdevs.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-common.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 8 ++++---- utils/v4l2-ctl/v4l2-ctl-io.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-meta.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-misc.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-modes.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-sdr.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-selection.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-stds.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-vidout.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl.cpp | 12 ++++++------ utils/v4l2-dbg/v4l2-dbg.cpp | 10 +++++----- 46 files changed, 236 insertions(+), 236 deletions(-)
utils/cec-compliance/cec-compliance.cpp +5 -5
@@ -4,17 +4,17 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/wait.h> #include <sstream>
utils/cec-compliance/cec-test-adapter.cpp +5 -5
@@ -4,16 +4,16 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/wait.h> #include <sstream>
utils/cec-compliance/cec-test-audio.cpp +5 -5
@@ -4,15 +4,15 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <config.h>
utils/cec-compliance/cec-test-fuzzing.cpp +5 -5
@@ -4,15 +4,15 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <config.h> #include <sstream>
utils/cec-compliance/cec-test-power.cpp +5 -5
@@ -4,15 +4,15 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <config.h>
utils/cec-compliance/cec-test.cpp +4 -4
@@ -6,14 +6,14 @@ #include <cstring> #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <config.h> #include <sstream>
utils/cec-ctl/cec-ctl.cpp +5 -5
@@ -6,8 +6,8 @@ #include <cstring> #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -15,10 +15,10 @@ #include <sys/time.h> #include <dirent.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> -#include <stdarg.h> +#include <cstdarg> #include <ctime> #include <cerrno> #include <string>
utils/cec-ctl/cec-pin.cpp +6 -6
@@ -4,19 +4,19 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> -#include <stdarg.h> +#include <cstdarg> #include <cerrno> #include <string> #include <vector>
utils/cec-follower/cec-follower.cpp +4 -4
@@ -6,15 +6,15 @@ #include <cstring> #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/wait.h> #include <sstream>
utils/cec-follower/cec-processing.cpp +5 -5
@@ -4,16 +4,16 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <config.h>
utils/cec-follower/cec-tuner.cpp +1 -1
@@ -4,7 +4,7 @@ */ #include <sys/ioctl.h> -#include <stdlib.h> +#include <cstdlib> #include "cec-follower.h" #include "compiler.h"
utils/common/media-info.cpp +5 -5
@@ -4,15 +4,15 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <sys/sysmacros.h>
utils/common/v4l2-info.cpp +5 -5
@@ -4,15 +4,15 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <sys/sysmacros.h>
utils/libcecutil/cec-info.cpp +1 -1
@@ -5,7 +5,7 @@ * Copyright 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ -#include <stdio.h> +#include <cstdio> #include <string> #include <unistd.h> #include <fcntl.h>
utils/libcecutil/cec-log.cpp +4 -4
@@ -4,11 +4,11 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> -#include <stdarg.h> +#include <cstdarg> #include <string> #include <linux/cec-funcs.h> #include "cec-htng-funcs.h"
utils/libcecutil/cec-parse.cpp +5 -5
@@ -4,8 +4,8 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -13,10 +13,10 @@ #include <sys/time.h> #include <dirent.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> -#include <stdarg.h> +#include <cstdarg> #include <cstring> #include <ctime> #include <cerrno>
utils/rds-ctl/rds-ctl.cpp +7 -7
@@ -8,21 +8,21 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <wchar.h> -#include <locale.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> +#include <cwchar> +#include <clocale> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <fcntl.h> -#include <errno.h> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> #include <config.h> -#include <signal.h> +#include <csignal> #include <linux/videodev2.h> #include <libv4l2rds.h>
utils/v4l2-compliance/v4l2-compliance.cpp +6 -6
@@ -21,22 +21,22 @@ #include <cstring> #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <sys/sysmacros.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include <sys/utsname.h> -#include <signal.h> +#include <csignal> #include <vector> #include "v4l2-compliance.h"
utils/v4l2-compliance/v4l2-test-buffers.cpp +5 -5
@@ -19,9 +19,9 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h>
@@ -29,8 +29,8 @@ #include <sys/wait.h> #include <sys/epoll.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <poll.h> #include <sys/ioctl.h> #include <netinet/in.h>
utils/v4l2-compliance/v4l2-test-codecs.cpp +6 -6
@@ -19,17 +19,17 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> -#include <assert.h> +#include <cassert> #include "v4l2-compliance.h" int testEncoder(struct node *node)
utils/v4l2-compliance/v4l2-test-colors.cpp +6 -6
@@ -15,19 +15,19 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> -#include <math.h> +#include <cmath> #include "compiler.h" #include "v4l2-compliance.h"
utils/v4l2-compliance/v4l2-test-controls.cpp +5 -5
@@ -19,15 +19,15 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <vector>
utils/v4l2-compliance/v4l2-test-debug.cpp +6 -6
@@ -19,19 +19,19 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> -#include <math.h> +#include <cmath> #include "v4l2-compliance.h" int testRegister(struct node *node)
utils/v4l2-compliance/v4l2-test-formats.cpp +6 -6
@@ -19,17 +19,17 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> -#include <assert.h> +#include <cassert> #include "compiler.h" #include "v4l2-compliance.h"
utils/v4l2-compliance/v4l2-test-input-output.cpp +5 -5
@@ -19,15 +19,15 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include "v4l2-compliance.h"
utils/v4l2-compliance/v4l2-test-io-config.cpp +5 -5
@@ -19,15 +19,15 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include "v4l2-compliance.h"
utils/v4l2-compliance/v4l2-test-media.cpp +6 -6
@@ -19,19 +19,19 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/sysmacros.h> #include <fcntl.h> #include <dirent.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> -#include <assert.h> +#include <cassert> #include <set> #include <fstream>
utils/v4l2-compliance/v4l2-test-subdevs.cpp +6 -6
@@ -19,17 +19,17 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> -#include <assert.h> +#include <cassert> #include "v4l2-compliance.h"
utils/v4l2-ctl/v4l2-ctl-common.cpp +5 -5
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/sysmacros.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include <linux/media.h> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-edid.cpp +4 -4
@@ -1,12 +1,12 @@ #include <cstring> #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-io.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-meta.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-misc.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-modes.cpp +2 -2
@@ -6,8 +6,8 @@ * reserved. */ -#include <stdio.h> -#include <stdbool.h> +#include <cstdio> + #include "v4l2-ctl.h" static bool valid_params(int width, int height, int refresh_rate)
utils/v4l2-ctl/v4l2-ctl-overlay.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include <linux/fb.h> #include <vector>
utils/v4l2-ctl/v4l2-ctl-sdr.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-selection.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-stds.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-streaming.cpp +5 -5
@@ -1,8 +1,8 @@ #include <cstring> #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>
@@ -11,13 +11,13 @@ #include <netinet/in.h> #include <netdb.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <sys/mman.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include <linux/media.h> #include "compiler.h"
utils/v4l2-ctl/v4l2-ctl-subdev.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-tuner.cpp +5 -5
@@ -1,14 +1,14 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h>
utils/v4l2-ctl/v4l2-ctl-vbi.cpp +5 -5
@@ -1,19 +1,19 @@ #include <cstring> #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "compiler.h" #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl-vidout.cpp +6 -6
@@ -1,18 +1,18 @@ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include "v4l2-ctl.h"
utils/v4l2-ctl/v4l2-ctl.cpp +6 -6
@@ -21,22 +21,22 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> +#include <cstdlib> +#include <cstdio> +#include <cstring> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/epoll.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> #include <sys/sysmacros.h> #include <dirent.h> -#include <math.h> +#include <cmath> #include <linux/media.h>
utils/v4l2-dbg/v4l2-dbg.cpp +5 -5
@@ -17,18 +17,18 @@ */ #include <unistd.h> -#include <stdlib.h> -#include <stdio.h> +#include <cstdlib> +#include <cstdio> #include <inttypes.h> #include <getopt.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <ctype.h> -#include <errno.h> +#include <cctype> +#include <cerrno> #include <sys/ioctl.h> #include <sys/time.h> -#include <math.h> +#include <cmath> #ifdef ANDROID #include <android-config.h>
Signature · 1 line
2.25.3
Re: [PATCH 7/7] utils: switch C to C++ headers
Quoted 5 lines · Rosen Penev
Recently, I changed
exit()to the std variant, which caused build failures on older platforms. Switch all headers to the C++ variants to avoid this.These C headers are deprecated by C++14.
What failures exactly? And on what platforms?
This patch changes a lot of files, and I'd like to have a bit more information before applying this.
I'll commit patches 5 and 6 of this series, but please repost the others with better commit logs that help me understand the reason for the change.
Regards,
Hans
Quoted 50 lines
Signed-off-by Rosen Penev <[email protected]>--- utils/cec-compliance/cec-compliance.cpp | 10 +++++----- utils/cec-compliance/cec-test-adapter.cpp | 10 +++++----- utils/cec-compliance/cec-test-audio.cpp | 10 +++++----- utils/cec-compliance/cec-test-fuzzing.cpp | 10 +++++----- utils/cec-compliance/cec-test-power.cpp | 10 +++++----- utils/cec-compliance/cec-test.cpp | 8 ++++---- utils/cec-ctl/cec-ctl.cpp | 10 +++++----- utils/cec-ctl/cec-pin.cpp | 12 ++++++------ utils/cec-follower/cec-follower.cpp | 8 ++++---- utils/cec-follower/cec-processing.cpp | 10 +++++----- utils/cec-follower/cec-tuner.cpp | 2 +- utils/common/media-info.cpp | 10 +++++----- utils/common/v4l2-info.cpp | 10 +++++----- utils/libcecutil/cec-info.cpp | 2 +- utils/libcecutil/cec-log.cpp | 8 ++++---- utils/libcecutil/cec-parse.cpp | 10 +++++----- utils/rds-ctl/rds-ctl.cpp | 14 +++++++------- utils/v4l2-compliance/v4l2-compliance.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-buffers.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-codecs.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-colors.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-controls.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-debug.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-formats.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-input-output.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-io-config.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-media.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-subdevs.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-common.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 8 ++++---- utils/v4l2-ctl/v4l2-ctl-io.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-meta.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-misc.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-modes.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-sdr.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-selection.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-stds.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-vidout.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl.cpp | 12 ++++++------ utils/v4l2-dbg/v4l2-dbg.cpp | 10 +++++----- 46 files changed, 236 insertions(+), 236 deletions(-)
Re: [PATCH 7/7] utils: switch C to C++ headers
Quoted 9 lines · Hans Verkuil
Quoted 5 lines · Rosen Penev
Recently, I changed
exit()to the std variant, which caused build failures on older platforms. Switch all headers to the C++ variants to avoid this.These C headers are deprecated by C++14.
What failures exactly? And on what platforms?
Maybe all.
std::exit needs cstdlib.
Build failure was privately reported to me for Ubuntu 18.04.
Quoted 63 lines
This patch changes a lot of files, and I'd like to have a bit more information before applying this.
I'll commit patches 5 and 6 of this series, but please repost the others with better commit logs that help me understand the reason for the change.
Regards,
Hans
Quoted 50 lines
Signed-off-by Rosen Penev <[email protected]>--- utils/cec-compliance/cec-compliance.cpp | 10 +++++----- utils/cec-compliance/cec-test-adapter.cpp | 10 +++++----- utils/cec-compliance/cec-test-audio.cpp | 10 +++++----- utils/cec-compliance/cec-test-fuzzing.cpp | 10 +++++----- utils/cec-compliance/cec-test-power.cpp | 10 +++++----- utils/cec-compliance/cec-test.cpp | 8 ++++---- utils/cec-ctl/cec-ctl.cpp | 10 +++++----- utils/cec-ctl/cec-pin.cpp | 12 ++++++------ utils/cec-follower/cec-follower.cpp | 8 ++++---- utils/cec-follower/cec-processing.cpp | 10 +++++----- utils/cec-follower/cec-tuner.cpp | 2 +- utils/common/media-info.cpp | 10 +++++----- utils/common/v4l2-info.cpp | 10 +++++----- utils/libcecutil/cec-info.cpp | 2 +- utils/libcecutil/cec-log.cpp | 8 ++++---- utils/libcecutil/cec-parse.cpp | 10 +++++----- utils/rds-ctl/rds-ctl.cpp | 14 +++++++------- utils/v4l2-compliance/v4l2-compliance.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-buffers.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-codecs.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-colors.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-controls.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-debug.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-formats.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-input-output.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-io-config.cpp | 10 +++++----- utils/v4l2-compliance/v4l2-test-media.cpp | 12 ++++++------ utils/v4l2-compliance/v4l2-test-subdevs.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-common.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 8 ++++---- utils/v4l2-ctl/v4l2-ctl-io.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-meta.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-misc.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-modes.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-sdr.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-selection.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-stds.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl-vidout.cpp | 12 ++++++------ utils/v4l2-ctl/v4l2-ctl.cpp | 12 ++++++------ utils/v4l2-dbg/v4l2-dbg.cpp | 10 +++++----- 46 files changed, 236 insertions(+), 236 deletions(-)
Hi Rosen,
Why this change? The commit log is empty, so I have no idea what the reason is for making this change. Same for the next 3 patches.
Regards,
Hans
Quoted 338 lines · Rosen Penev
Signed-off-by Rosen Penev <[email protected]>--- utils/cec-compliance/cec-test.cpp | 5 +++-- utils/cec-ctl/cec-ctl.cpp | 13 +++++++------ utils/cec-follower/cec-follower.cpp | 5 +++-- utils/libcecutil/cec-parse.cpp | 4 ++-- utils/v4l2-compliance/v4l2-compliance.cpp | 5 +++-- utils/v4l2-ctl/v4l2-ctl-common.cpp | 8 ++++---- utils/v4l2-ctl/v4l2-ctl-edid.cpp | 5 +++-- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 7 ++++--- utils/v4l2-ctl/v4l2-ctl-vbi.cpp | 5 +++-- utils/v4l2-dbg/v4l2-dbg.cpp | 4 ++-- 10 files changed, 34 insertions(+), 27 deletions(-)utils/cec-compliance/cec-test.cpp +3
-2@@ -3,10 +3,11 @@ * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h>@@ -1530,7 +1531,7 @@ void listTests() int setExpectedResult(char *optarg, bool no_warnings) { - char *equal = strchr(optarg, '='); + char *equal = std::strchr(optarg, '='); if (!equal || equal == optarg || !isdigit(equal[1])) return 1;utils/cec-ctl/cec-ctl.cpp +7
-6@@ -3,10 +3,11 @@ * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>@@ -1917,7 +1918,7 @@ int main(int argc, char **argv) case OptIgnore: { bool all_la = !strncmp(optarg, "all", 3); bool all_opcodes = true; - const char *sep = strchr(optarg, ','); + const char *sep = std::strchr(optarg, ','); unsigned la_mask = 0xffff, opcode, la = 0; if (sep)@@ -2068,7 +2069,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++;@@ -2109,7 +2110,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++;@@ -2150,7 +2151,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++;@@ -2184,7 +2185,7 @@ int main(int argc, char **argv) size--; break; } - value = strchr(value, ':'); + value = std::strchr(value, ':'); if (value == NULL) break; value++;utils/cec-follower/cec-follower.cpp +3
-2@@ -3,10 +3,11 @@ * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>@@ -386,7 +387,7 @@ int main(int argc, char **argv) case OptIgnore: { bool all_la = !strncmp(optarg, "all", 3); bool all_opcodes = true; - const char *sep = strchr(optarg, ','); + const char *sep = std::strchr(optarg, ','); unsigned la_mask = 0xffff, opcode, la = 0; if (sep)utils/libcecutil/cec-parse.cpp +2
-2@@ -6,7 +6,6 @@ #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>@@ -18,6 +17,7 @@ #include <errno.h> #include <sys/ioctl.h> #include <stdarg.h> +#include <cstring> #include <ctime> #include <cerrno> #include <string>@@ -191,7 +191,7 @@ unsigned cec_parse_phys_addr(const char *value) { unsigned p1, p2, p3, p4; - if (!strchr(value, '.')) + if (!std::strchr(value, '.')) return strtoul(value, NULL, 0); if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) { fprintf(stderr, "Expected a physical address of the form x.x.x.x\n");utils/v4l2-compliance/v4l2-compliance.cpp +3
-2@@ -18,10 +18,11 @@ Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>@@ -1580,7 +1581,7 @@ int main(int argc, char **argv) break; case OptStreamFrom: case OptStreamFromHdr: { - char *equal = strchr(optarg, '='); + char *equal = std::strchr(optarg, '='); bool has_hdr = ch == OptStreamFromHdr; if (equal == optarg)utils/v4l2-ctl/v4l2-ctl-common.cpp +4
-4@@ -1,7 +1,6 @@ #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>@@ -22,6 +21,7 @@ #include <sys/klog.h> #endif +#include <cstring> #include <list> #include <vector> #include <map>@@ -741,7 +741,7 @@ static bool parse_subset(char *optarg) memset(&subset, 0, sizeof(subset)); while (*optarg) { - p = strchr(optarg, ','); + p = std::strchr(optarg, ','); if (p) *p = 0; if (optarg[0] == 0) {@@ -808,7 +808,7 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) common_usage(); std::exit(EXIT_FAILURE); } - if (strchr(value, '=')) { + if (std::strchr(value, '=')) { common_usage(); std::exit(EXIT_FAILURE); }@@ -824,7 +824,7 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg) common_usage(); std::exit(EXIT_FAILURE); } - if (const char *equal = strchr(value, '=')) { + if (const char *equal = std::strchr(value, '=')) { set_ctrls[std::string(value, (equal - value))] = equal + 1; } else {utils/v4l2-ctl/v4l2-ctl-edid.cpp +3
-2@@ -1,7 +1,8 @@ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <fcntl.h> #include <ctype.h>@@ -710,7 +711,7 @@ static unsigned short parse_phys_addr(const char *value) { unsigned p1, p2, p3, p4; - if (!strchr(value, '.')) + if (!std::strchr(value, '.')) return strtoul(value, NULL, 0); if (sscanf(value, "%x.%x.%x.%x", &p1, &p2, &p3, &p4) != 4) { fprintf(stderr, "Expected a physical address of the form x.x.x.x\n");utils/v4l2-ctl/v4l2-ctl-streaming.cpp +4
-3@@ -1,7 +1,8 @@ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>@@ -1660,7 +1661,7 @@ static FILE *open_output_file(cv4l_fd &fd) if (!host_to) return NULL; - char *p = strchr(host_to, ':'); + char *p = std::strchr(host_to, ':'); struct sockaddr_in serv_addr; struct hostent *server; struct v4l2_fract aspect;@@ -1925,7 +1926,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type) if (!host_from) return NULL; - char *p = strchr(host_from, ':'); + char *p = std::strchr(host_from, ':'); int listen_fd; socklen_t clilen; struct sockaddr_in serv_addr = {}, cli_addr;utils/v4l2-ctl/v4l2-ctl-vbi.cpp +3
-2@@ -1,7 +1,8 @@ +#include <cstring> + #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>@@ -98,7 +99,7 @@ void vbi_cmd(int ch, char *optarg) std::exit(EXIT_FAILURE); } while (*optarg) { - subs = strchr(optarg, ','); + subs = std::strchr(optarg, ','); if (subs) *subs = 0;utils/v4l2-dbg/v4l2-dbg.cpp +2
-2@@ -19,7 +19,6 @@ #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <string.h> #include <inttypes.h> #include <getopt.h> #include <sys/types.h>@@ -43,6 +42,7 @@ #include <linux/videodev2.h> +#include <cstring> #include <list> #include <vector> #include <map>@@ -731,7 +731,7 @@ int main(int argc, char **argv) goto list_done; } - p = strchr(chip_info.name, ' '); + p = std::strchr(chip_info.name, ' '); if (p) *p = '\0'; name = chip_info.name;