diff mbox series

[FFmpeg-devel,3/3] avfilter/allfilters: Don't cast const away

Message ID 20200822230434.11347-3-andreas.rheinhardt@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/3] avfilter/graphparser: Fix leaks when parsing inputs fails
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 22, 2020, 11:04 p.m. UTC
Casting const away directly before return is completely pointless
here as avfilter_get_by_name() already returns a const AVFilter *.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavfilter/allfilters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

zhilizhao(赵志立) Aug. 23, 2020, 2:20 a.m. UTC | #1
> On Aug 23, 2020, at 7:04 AM, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> 
> Casting const away directly before return is completely pointless
> here as avfilter_get_by_name() already returns a const AVFilter *.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> libavfilter/allfilters.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 3f70153986..fa91e608e4 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -528,7 +528,7 @@ const AVFilter *avfilter_get_by_name(const char *name)
> 
>     while ((f = av_filter_iterate(&opaque)))
>         if (!strcmp(f->name, name))
> -            return (AVFilter *)f;
> +            return f;
> 

I have a same patch long time ago.

http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html>

>     return NULL;
> }
> -- 
> 2.20.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Andreas Rheinhardt Aug. 23, 2020, 8:51 a.m. UTC | #2
Zhao Zhili:
> 
>> On Aug 23, 2020, at 7:04 AM, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
>>
>> Casting const away directly before return is completely pointless
>> here as avfilter_get_by_name() already returns a const AVFilter *.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>> libavfilter/allfilters.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>> index 3f70153986..fa91e608e4 100644
>> --- a/libavfilter/allfilters.c
>> +++ b/libavfilter/allfilters.c
>> @@ -528,7 +528,7 @@ const AVFilter *avfilter_get_by_name(const char *name)
>>
>>     while ((f = av_filter_iterate(&opaque)))
>>         if (!strcmp(f->name, name))
>> -            return (AVFilter *)f;
>> +            return f;
>>
> 
> I have a same patch long time ago.
> 
> http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html>
> 
I applied your patch (as 26f81e5e83a015578c4c0c1d121a5e5f6c72bf8a).

- Andreas
zhilizhao(赵志立) Aug. 23, 2020, 3:31 p.m. UTC | #3
> On Aug 23, 2020, at 4:51 PM, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> 
> Zhao Zhili:
>> 
>>> On Aug 23, 2020, at 7:04 AM, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
>>> 
>>> Casting const away directly before return is completely pointless
>>> here as avfilter_get_by_name() already returns a const AVFilter *.
>>> 
>>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>>> ---
>>> libavfilter/allfilters.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>>> index 3f70153986..fa91e608e4 100644
>>> --- a/libavfilter/allfilters.c
>>> +++ b/libavfilter/allfilters.c
>>> @@ -528,7 +528,7 @@ const AVFilter *avfilter_get_by_name(const char *name)
>>> 
>>>    while ((f = av_filter_iterate(&opaque)))
>>>        if (!strcmp(f->name, name))
>>> -            return (AVFilter *)f;
>>> +            return f;
>>> 
>> 
>> I have a same patch long time ago.
>> 
>> http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html> <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html>>
>> 
> I applied your patch (as 26f81e5e83a015578c4c0c1d121a5e5f6c72bf8a).

Thank you. Current review process is easy to lost track.

> 
> - Andreas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org <mailto:ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe".
zhilizhao(赵志立) Aug. 27, 2020, 8:51 p.m. UTC | #4
> On Aug 28, 2020, at 3:33 PM, Moritz Barsnick <barsnick@gmx.net> wrote:
> 
> On Sun, Aug 23, 2020 at 23:31:45 +0800, Zhao Zhili wrote:
>>>> I have a same patch long time ago.
>>>> 
>>>> http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html> <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html>>
>>>> 
>>> I applied your patch (as 26f81e5e83a015578c4c0c1d121a5e5f6c72bf8a).
>> 
>> Thank you. Current review process is easy to lost track.
> 
> There was an unelaborated "breaks ABI" comment to that patch, which is
> why Michael never applied, after originally announcing to do so.

Yes, I understand why it’s not applied. It’s my mistake to forget the patch,
but a merge-request/pull-request tracking system is useful in this case.
Now I found out patchwork can query with submitter, which is better than
nothing.

> 
> Moritz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Moritz Barsnick Aug. 28, 2020, 7:33 a.m. UTC | #5
On Sun, Aug 23, 2020 at 23:31:45 +0800, Zhao Zhili wrote:
> >> I have a same patch long time ago.
> >>
> >> http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html> <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html <http://ffmpeg.org/pipermail/ffmpeg-devel/2019-October/252193.html>>
> >>
> > I applied your patch (as 26f81e5e83a015578c4c0c1d121a5e5f6c72bf8a).
>
> Thank you. Current review process is easy to lost track.

There was an unelaborated "breaks ABI" comment to that patch, which is
why Michael never applied, after originally announcing to do so.

Moritz
diff mbox series

Patch

diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3f70153986..fa91e608e4 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -528,7 +528,7 @@  const AVFilter *avfilter_get_by_name(const char *name)
 
     while ((f = av_filter_iterate(&opaque)))
         if (!strcmp(f->name, name))
-            return (AVFilter *)f;
+            return f;
 
     return NULL;
 }