This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit d7a079279fadd5a6c575fc4223a9c97fa1d9f059
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Feb 16 12:13:04 2026 +0100
Commit:     Niklas Haas <[email protected]>
CommitDate: Sat Mar 28 16:48:13 2026 +0000

    swscale/tests/sws_ops: refactor argument parsing
    
    To allow for argumentless options in the future.
    
    Signed-off-by: Niklas Haas <[email protected]>
---
 libswscale/tests/sws_ops.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libswscale/tests/sws_ops.c b/libswscale/tests/sws_ops.c
index ba5d047005..616840c1ec 100644
--- a/libswscale/tests/sws_ops.c
+++ b/libswscale/tests/sws_ops.c
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
     _setmode(_fileno(stdout), _O_BINARY);
 #endif
 
-    for (int i = 1; i < argc; i += 2) {
+    for (int i = 1; i < argc; i++) {
         if (!strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
             fprintf(stderr,
                     "sws_ops [options...]\n"
@@ -74,22 +74,29 @@ int main(int argc, char **argv)
             );
             return 0;
         }
-        if (argv[i][0] != '-' || i + 1 == argc)
-            goto bad_option;
         if (!strcmp(argv[i], "-src")) {
+            if (i + 1 >= argc)
+                goto bad_option;
             src_fmt = av_get_pix_fmt(argv[i + 1]);
             if (src_fmt == AV_PIX_FMT_NONE) {
                 fprintf(stderr, "invalid pixel format %s\n", argv[i + 1]);
                 goto error;
             }
+            i++;
         } else if (!strcmp(argv[i], "-dst")) {
+            if (i + 1 >= argc)
+                goto bad_option;
             dst_fmt = av_get_pix_fmt(argv[i + 1]);
             if (dst_fmt == AV_PIX_FMT_NONE) {
                 fprintf(stderr, "invalid pixel format %s\n", argv[i + 1]);
                 goto error;
             }
+            i++;
         } else if (!strcmp(argv[i], "-v")) {
+            if (i + 1 >= argc)
+                goto bad_option;
             av_log_set_level(atoi(argv[i + 1]));
+            i++;
         } else {
 bad_option:
             fprintf(stderr, "bad option or argument missing (%s) see -help\n", 
argv[i]);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to