[FFmpeg-cvslog] fftools/cmdutils: do not treat single '-' as an option in locate_option()

Anton Khirnov git at videolan.org
Thu Oct 10 10:15:51 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Oct  7 11:52:30 2024 +0200| [840b95bcc2296cc3005594b6d3d5af3eeadee319] | committer: Anton Khirnov

fftools/cmdutils: do not treat single '-' as an option in locate_option()

Fixes early parsing of trailing -v/-loglevel while using '-' to output
to stdout.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=840b95bcc2296cc3005594b6d3d5af3eeadee319
---

 fftools/cmdutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 9eb49dbf20..8ac20bf049 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -492,8 +492,9 @@ int locate_option(int argc, char **argv, const OptionDef *options,
     for (i = 1; i < argc; i++) {
         const char *cur_opt = argv[i];
 
-        if (*cur_opt++ != '-')
+        if (!(cur_opt[0] == '-' && cur_opt[1]))
             continue;
+        cur_opt++;
 
         po = find_option(options, cur_opt);
         if (!po->name && cur_opt[0] == 'n' && cur_opt[1] == 'o')



More information about the ffmpeg-cvslog mailing list