[FFmpeg-cvslog] fftools/ffmpeg: _-prefix variables in MATCH_PER_STREAM_OPT()
Anton Khirnov
git at videolan.org
Wed Nov 23 11:52:16 EET 2022
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Nov 17 10:38:12 2022 +0100| [3da5c60aa9b1853119121cf52cb723fdb6b53fab] | committer: Anton Khirnov
fftools/ffmpeg: _-prefix variables in MATCH_PER_STREAM_OPT()
Avoids conflicts, e.g. when 'i' is used in the outvar expression.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3da5c60aa9b1853119121cf52cb723fdb6b53fab
---
fftools/ffmpeg.h | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 5fc3b2d3d4..5cae266600 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -783,26 +783,26 @@ InputStream *ist_iter(InputStream *prev);
{\
char namestr[128] = "";\
const char *spec = so->specifier && so->specifier[0] ? so->specifier : "";\
- for (i = 0; opt_name_##name[i]; i++)\
- av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[i], opt_name_##name[i+1] ? (opt_name_##name[i+2] ? ", " : " or ") : "");\
+ for (int _i = 0; opt_name_##name[_i]; _i++)\
+ av_strlcatf(namestr, sizeof(namestr), "-%s%s", opt_name_##name[_i], opt_name_##name[_i+1] ? (opt_name_##name[_i+2] ? ", " : " or ") : "");\
av_log(NULL, AV_LOG_WARNING, "Multiple %s options specified for stream %d, only the last option '-%s%s%s "SPECIFIER_OPT_FMT_##type"' will be used.\n",\
namestr, st->index, opt_name_##name[0], spec[0] ? ":" : "", spec, so->u.type);\
}
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
{\
- int i, ret, matches = 0;\
+ int _ret, _matches = 0;\
SpecifierOpt *so;\
- for (i = 0; i < o->nb_ ## name; i++) {\
- char *spec = o->name[i].specifier;\
- if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
- outvar = o->name[i].u.type;\
- so = &o->name[i];\
- matches++;\
- } else if (ret < 0)\
+ for (int _i = 0; _i < o->nb_ ## name; _i++) {\
+ char *spec = o->name[_i].specifier;\
+ if ((_ret = check_stream_specifier(fmtctx, st, spec)) > 0) {\
+ outvar = o->name[_i].u.type;\
+ so = &o->name[_i];\
+ _matches++;\
+ } else if (_ret < 0)\
exit_program(1);\
}\
- if (matches > 1)\
+ if (_matches > 1)\
WARN_MULTIPLE_OPT_USAGE(name, type, so, st);\
}
More information about the ffmpeg-cvslog
mailing list