diff mbox series

[FFmpeg-devel,02/60] fftools/opt_common: fix variable shadowing

Message ID D41CE2FHV3U8.2ZW7RI4PHNBC0@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/60] fftools/ffmpeg_opt: fix variable shadowing | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz Sept. 8, 2024, 5:43 p.m. UTC
---
 fftools/opt_common.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Anton Khirnov Sept. 9, 2024, 10:10 a.m. UTC | #1
Quoting Marvin Scholz (2024-09-08 19:43:27)
> ---
>  fftools/opt_common.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fftools/opt_common.c b/fftools/opt_common.c
> index 9d2d5184a0..059f7a53d2 100644
> --- a/fftools/opt_common.c
> +++ b/fftools/opt_common.c
> @@ -553,15 +553,15 @@ static void show_help_filter(const char *name)
>  }
>  #endif
>  
> -static void show_help_bsf(const char *name)
> +static void show_help_bsf(const char *bsf_name)
>  {
> -    const AVBitStreamFilter *bsf = av_bsf_get_by_name(name);
> +    const AVBitStreamFilter *bsf = av_bsf_get_by_name(bsf_name);
>  
> -    if (!name) {
> +    if (!bsf_name) {
>          av_log(NULL, AV_LOG_ERROR, "No bitstream filter name specified.\n");
>          return;
>      } else if (!bsf) {
> -        av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", name);
> +        av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", bsf_name);

What does this fix? I don't see any other instance of 'name' in this
function.

>          return;
>      }
>  
> @@ -1205,10 +1205,10 @@ int init_report(const char *env, FILE **file)
>  
>      report_file = fopen(filename.str, "w");
>      if (!report_file) {
> -        int ret = AVERROR(errno);
> +        int err = AVERROR(errno);
>          av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
>                 filename.str, strerror(errno));
> -        return ret;
> +        return err;

Might as well use the outer ret.
Anton Khirnov Sept. 9, 2024, 11:01 a.m. UTC | #2
Quoting epirat07@gmail.com (2024-09-09 12:48:42)
> 
> 
> On 9 Sep 2024, at 12:10, Anton Khirnov wrote:
> 
> > Quoting Marvin Scholz (2024-09-08 19:43:27)
> >> ---
> >>  fftools/opt_common.c | 12 ++++++------
> >>  1 file changed, 6 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/fftools/opt_common.c b/fftools/opt_common.c
> >> index 9d2d5184a0..059f7a53d2 100644
> >> --- a/fftools/opt_common.c
> >> +++ b/fftools/opt_common.c
> >> @@ -553,15 +553,15 @@ static void show_help_filter(const char *name)
> >>  }
> >>  #endif
> >>
> >> -static void show_help_bsf(const char *name)
> >> +static void show_help_bsf(const char *bsf_name)
> >>  {
> >> -    const AVBitStreamFilter *bsf = av_bsf_get_by_name(name);
> >> +    const AVBitStreamFilter *bsf = av_bsf_get_by_name(bsf_name);
> >>
> >> -    if (!name) {
> >> +    if (!bsf_name) {
> >>          av_log(NULL, AV_LOG_ERROR, "No bitstream filter name specified.\n");
> >>          return;
> >>      } else if (!bsf) {
> >> -        av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", name);
> >> +        av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", bsf_name);
> >
> > What does this fix? I don't see any other instance of 'name' in this
> > function.
> 
> See the GET_CODEC_NAME definition:
> 
>   const char *name = avcodec_descriptor_get(id)->name;

Does not exist in master after 377652da19bd1e5b9d81c22a4fce0a78a62b5853
diff mbox series

Patch

diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 9d2d5184a0..059f7a53d2 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -553,15 +553,15 @@  static void show_help_filter(const char *name)
 }
 #endif
 
-static void show_help_bsf(const char *name)
+static void show_help_bsf(const char *bsf_name)
 {
-    const AVBitStreamFilter *bsf = av_bsf_get_by_name(name);
+    const AVBitStreamFilter *bsf = av_bsf_get_by_name(bsf_name);
 
-    if (!name) {
+    if (!bsf_name) {
         av_log(NULL, AV_LOG_ERROR, "No bitstream filter name specified.\n");
         return;
     } else if (!bsf) {
-        av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", name);
+        av_log(NULL, AV_LOG_ERROR, "Unknown bit stream filter '%s'.\n", bsf_name);
         return;
     }
 
@@ -1205,10 +1205,10 @@  int init_report(const char *env, FILE **file)
 
     report_file = fopen(filename.str, "w");
     if (!report_file) {
-        int ret = AVERROR(errno);
+        int err = AVERROR(errno);
         av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n",
                filename.str, strerror(errno));
-        return ret;
+        return err;
     }
     av_log_set_callback(log_callback_report);
     av_log(NULL, AV_LOG_INFO,