This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: v4l2-ctl: use strtoul instead of strtol where appropriate Author: Hans Verkuil <[email protected]> Date: Fri Sep 26 10:16:45 2025 +0200 In several cases command line arguments were parsed using strtol, even though the argument can never be negative. Change it to strtoul. Signed-off-by: Hans Verkuil <[email protected]> utils/v4l2-ctl/v4l2-ctl-io.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-meta.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-overlay.cpp | 10 +++++----- utils/v4l2-ctl/v4l2-ctl-sdr.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-selection.cpp | 4 ++-- utils/v4l2-ctl/v4l2-ctl-stds.cpp | 2 +- utils/v4l2-ctl/v4l2-ctl-tuner.cpp | 8 ++++---- utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 8 ++++---- utils/v4l2-ctl/v4l2-ctl.cpp | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=703432c686c6c267ed7de646042ba9d6f0445ace diff --git a/utils/v4l2-ctl/v4l2-ctl-io.cpp b/utils/v4l2-ctl/v4l2-ctl-io.cpp index 2c51e5736408..b20e02fa20f9 100644 --- a/utils/v4l2-ctl/v4l2-ctl-io.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-io.cpp @@ -69,10 +69,10 @@ void io_cmd(int ch, char *optarg) output = strtol(optarg, nullptr, 0); break; case OptSetAudioInput: - vaudio.index = strtol(optarg, nullptr, 0); + vaudio.index = strtoul(optarg, nullptr, 0); break; case OptSetAudioOutput: - vaudout.index = strtol(optarg, nullptr, 0); + vaudout.index = strtoul(optarg, nullptr, 0); break; } } diff --git a/utils/v4l2-ctl/v4l2-ctl-meta.cpp b/utils/v4l2-ctl/v4l2-ctl-meta.cpp index 0d0ea660a86b..634aba8ce0ca 100644 --- a/utils/v4l2-ctl/v4l2-ctl-meta.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-meta.cpp @@ -56,7 +56,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, nullptr, 0); + vfmt.fmt.meta.dataformat = strtoul(optarg, nullptr, 0); } break; case OptListMetaFormats: diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp index 797b3f34f4dd..461ed9f05182 100644 --- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp @@ -321,27 +321,27 @@ void overlay_cmd(int ch, char *optarg) switch (parse_subopt(&subs, subopts, &value)) { case 0: fbuf.flags &= ~chroma_flags; - fbuf.flags |= strtol(value, nullptr, 0) ? V4L2_FBUF_FLAG_CHROMAKEY : 0; + fbuf.flags |= strtoul(value, nullptr, 0) ? V4L2_FBUF_FLAG_CHROMAKEY : 0; set_fbuf |= chroma_flags; break; case 1: fbuf.flags &= ~chroma_flags; - fbuf.flags |= strtol(value, nullptr, 0) ? V4L2_FBUF_FLAG_SRC_CHROMAKEY : 0; + fbuf.flags |= strtoul(value, nullptr, 0) ? V4L2_FBUF_FLAG_SRC_CHROMAKEY : 0; set_fbuf |= chroma_flags; break; case 2: fbuf.flags &= ~alpha_flags; - fbuf.flags |= strtol(value, nullptr, 0) ? V4L2_FBUF_FLAG_GLOBAL_ALPHA : 0; + fbuf.flags |= strtoul(value, nullptr, 0) ? V4L2_FBUF_FLAG_GLOBAL_ALPHA : 0; set_fbuf |= alpha_flags; break; case 3: fbuf.flags &= ~alpha_flags; - fbuf.flags |= strtol(value, nullptr, 0) ? V4L2_FBUF_FLAG_LOCAL_ALPHA : 0; + fbuf.flags |= strtoul(value, nullptr, 0) ? V4L2_FBUF_FLAG_LOCAL_ALPHA : 0; set_fbuf |= alpha_flags; break; case 4: fbuf.flags &= ~alpha_flags; - fbuf.flags |= strtol(value, nullptr, 0) ? V4L2_FBUF_FLAG_LOCAL_INV_ALPHA : 0; + fbuf.flags |= strtoul(value, nullptr, 0) ? V4L2_FBUF_FLAG_LOCAL_INV_ALPHA : 0; set_fbuf |= alpha_flags; break; case 5: diff --git a/utils/v4l2-ctl/v4l2-ctl-sdr.cpp b/utils/v4l2-ctl/v4l2-ctl-sdr.cpp index 6f4a012a6fcd..4703d5e88af6 100644 --- a/utils/v4l2-ctl/v4l2-ctl-sdr.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-sdr.cpp @@ -41,7 +41,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, nullptr, 0); + vfmt.fmt.sdr.pixelformat = strtoul(optarg, nullptr, 0); } break; } diff --git a/utils/v4l2-ctl/v4l2-ctl-selection.cpp b/utils/v4l2-ctl/v4l2-ctl-selection.cpp index 68a39c149430..e9c75cd59314 100644 --- a/utils/v4l2-ctl/v4l2-ctl-selection.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-selection.cpp @@ -111,11 +111,11 @@ static void parse_crop(char *optarg, unsigned int &set_crop, v4l2_rect &vcrop) set_crop |= CropTop; break; case 2: - vcrop.width = strtol(value, nullptr, 0); + vcrop.width = strtoul(value, nullptr, 0); set_crop |= CropWidth; break; case 3: - vcrop.height = strtol(value, nullptr, 0); + vcrop.height = strtoul(value, nullptr, 0); set_crop |= CropHeight; break; default: diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp index 8c9abf5df687..040a80764ed4 100644 --- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp @@ -446,7 +446,7 @@ void stds_cmd(int ch, char *optarg) standard = V4L2_STD_SECAM; } else if (isdigit(optarg[0])) { - standard = strtol(optarg, nullptr, 0) | (1ULL << 63); + standard = strtoul(optarg, nullptr, 0) | (1ULL << 63); } else { fprintf(stderr, "Unknown standard '%s'\n", optarg); stds_usage(); diff --git a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp index 2b0553d0f710..d1a429260c2b 100644 --- a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp @@ -62,13 +62,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, nullptr, 0); + seek.seek_upward = strtoul(value, nullptr, 0); break; case 1: - seek.wrap_around = strtol(value, nullptr, 0); + seek.wrap_around = strtoul(value, nullptr, 0); break; case 2: - seek.spacing = strtol(value, nullptr, 0); + seek.spacing = strtoul(value, nullptr, 0); break; case 3: low = strtod(value, nullptr); @@ -107,7 +107,7 @@ void tuner_cmd(int ch, char *optarg) } break; case OptSetModulator: - txsubchans = strtol(optarg, nullptr, 0); + txsubchans = strtoul(optarg, nullptr, 0); if (!strcmp(optarg, "stereo")) txsubchans = V4L2_TUNER_SUB_STEREO; else if (!strcmp(optarg, "stereo-sap")) diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp index 498362217149..a16443f4d682 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp @@ -134,7 +134,7 @@ void vidcap_cmd(int ch, char *optarg) if (be_pixfmt) frmsize.pixel_format |= 1U << 31; } else if (isdigit(optarg[0])) { - frmsize.pixel_format = strtol(optarg, nullptr, 0); + frmsize.pixel_format = strtoul(optarg, nullptr, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg); std::exit(EXIT_FAILURE); @@ -152,10 +152,10 @@ void vidcap_cmd(int ch, char *optarg) switch (parse_subopt(&subs, subopts, &value)) { case 0: - frmival.width = strtol(value, nullptr, 0); + frmival.width = strtoul(value, nullptr, 0); break; case 1: - frmival.height = strtol(value, nullptr, 0); + frmival.height = strtoul(value, nullptr, 0); break; case 2: be_pixfmt = strlen(value) == 7 && !memcmp(value + 4, "-BE", 3); @@ -166,7 +166,7 @@ void vidcap_cmd(int ch, char *optarg) if (be_pixfmt) frmival.pixel_format |= 1U << 31; } else if (isdigit(optarg[0])) { - frmival.pixel_format = strtol(value, nullptr, 0); + frmival.pixel_format = strtoul(value, nullptr, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg); std::exit(EXIT_FAILURE); diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index 9b5b87895149..30a6db694f96 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -813,7 +813,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat, if (be_pixfmt) pixelformat |= 1U << 31; } else if (isdigit(value[0])) { - pixelformat = strtol(value, nullptr, 0); + pixelformat = strtoul(value, nullptr, 0); } else { fprintf(stderr, "The pixelformat '%s' is invalid\n", value); std::exit(EXIT_FAILURE);
