diff mbox

[FFmpeg-devel] avfilter: remove useless cast

Message ID 20191027160236.59127-1-quinkblack@foxmail.com
State New
Headers show

Commit Message

Zhao Zhili Oct. 27, 2019, 4:02 p.m. UTC
---
 libavfilter/allfilters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jun Zhao Oct. 28, 2019, 3:18 a.m. UTC | #1
On Mon, Oct 28, 2019 at 12:03 AM Zhao Zhili <quinkblack@foxmail.com> wrote:
>
> ---
>  libavfilter/allfilters.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index d136734338..6156066028 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -503,7 +503,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;
>  }
> --
> 2.21.0
LGTM
Michael Niedermayer Oct. 29, 2019, 1:13 p.m. UTC | #2
On Mon, Oct 28, 2019 at 11:18:04AM +0800, mypopy@gmail.com wrote:
> On Mon, Oct 28, 2019 at 12:03 AM Zhao Zhili <quinkblack@foxmail.com> wrote:
> >
> > ---
> >  libavfilter/allfilters.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > index d136734338..6156066028 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -503,7 +503,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;
> >  }
> > --
> > 2.21.0
> LGTM

will apply

thx

[...]
Paul B Mahol Oct. 29, 2019, 1:15 p.m. UTC | #3
On 10/29/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> On Mon, Oct 28, 2019 at 11:18:04AM +0800, mypopy@gmail.com wrote:
>> On Mon, Oct 28, 2019 at 12:03 AM Zhao Zhili <quinkblack@foxmail.com>
>> wrote:
>> >
>> > ---
>> >  libavfilter/allfilters.c | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>> > index d136734338..6156066028 100644
>> > --- a/libavfilter/allfilters.c
>> > +++ b/libavfilter/allfilters.c
>> > @@ -503,7 +503,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;
>> >  }
>> > --
>> > 2.21.0
>> LGTM
>
> will apply
>

Breaks ABI.

> thx
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Good people do not need laws to tell them to act responsibly, while bad
> people will find a way around the laws. -- Plato
>
Zhao Zhili Oct. 29, 2019, 2:28 p.m. UTC | #4
> On Oct 29, 2019, at 9:15 PM, Paul B Mahol <onemda@gmail.com> wrote:
> 
> On 10/29/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
>> On Mon, Oct 28, 2019 at 11:18:04AM +0800, mypopy@gmail.com wrote:
>>> On Mon, Oct 28, 2019 at 12:03 AM Zhao Zhili <quinkblack@foxmail.com>
>>> wrote:
>>>> 
>>>> ---
>>>> libavfilter/allfilters.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>> 
>>>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>>>> index d136734338..6156066028 100644
>>>> --- a/libavfilter/allfilters.c
>>>> +++ b/libavfilter/allfilters.c
>>>> @@ -503,7 +503,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;
>>>> }
>>>> --
>>>> 2.21.0
>>> LGTM
>> 
>> will apply
>> 
> 
> Breaks ABI.

I don’t get it, would you care to elaborate?

> 
>> thx
>> 
>> [...]
>> 
>> --
>> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>> 
>> Good people do not need laws to tell them to act responsibly, while bad
>> people will find a way around the laws. -- Plato
>> 
> _______________________________________________
> 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".
Zhao Zhili Nov. 6, 2019, 1:09 p.m. UTC | #5
> On Oct 29, 2019, at 10:28 PM, zhilizhao(赵志立) <quinkblack@foxmail.com> wrote:
> 
> 
>> On Oct 29, 2019, at 9:15 PM, Paul B Mahol <onemda@gmail.com> wrote:
>> 
>> On 10/29/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
>>> On Mon, Oct 28, 2019 at 11:18:04AM +0800, mypopy@gmail.com wrote:
>>>> On Mon, Oct 28, 2019 at 12:03 AM Zhao Zhili <quinkblack@foxmail.com>
>>>> wrote:
>>>>> 
>>>>> ---
>>>>> libavfilter/allfilters.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>> 
>>>>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>>>>> index d136734338..6156066028 100644
>>>>> --- a/libavfilter/allfilters.c
>>>>> +++ b/libavfilter/allfilters.c
>>>>> @@ -503,7 +503,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;
>>>>> }
>>>>> --
>>>>> 2.21.0
>>>> LGTM
>>> 
>>> will apply
>>> 
>> 
>> Breaks ABI.
> 
> I don’t get it, would you care to elaborate?

Ping.

> 
>> 
>>> thx
>>> 
>>> [...]
>>> 
>>> --
>>> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>> 
>>> Good people do not need laws to tell them to act responsibly, while bad
>>> people will find a way around the laws. -- Plato
>>> 
>> _______________________________________________
>> 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".
>
Fu, Linjie Nov. 6, 2019, 2:15 p.m. UTC | #6
> -----Original Message-----

> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of

> "zhilizhao(???)"

> Sent: Wednesday, November 6, 2019 21:09

> To: FFmpeg development discussions and patches <ffmpeg-

> devel@ffmpeg.org>

> Subject: Re: [FFmpeg-devel] [PATCH] avfilter: remove useless cast

> 

> 

> 

> > On Oct 29, 2019, at 10:28 PM, zhilizhao(赵志立) <quinkblack@foxmail.com>

> wrote:

> >

> >

> >> On Oct 29, 2019, at 9:15 PM, Paul B Mahol <onemda@gmail.com> wrote:

> >>

> >> On 10/29/19, Michael Niedermayer <michael@niedermayer.cc> wrote:

> >>> On Mon, Oct 28, 2019 at 11:18:04AM +0800, mypopy@gmail.com wrote:

> >>>> On Mon, Oct 28, 2019 at 12:03 AM Zhao Zhili <quinkblack@foxmail.com>

> >>>> wrote:

> >>>>>

> >>>>> ---

> >>>>> libavfilter/allfilters.c | 2 +-

> >>>>> 1 file changed, 1 insertion(+), 1 deletion(-)

> >>>>>

> >>>>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c

> >>>>> index d136734338..6156066028 100644

> >>>>> --- a/libavfilter/allfilters.c

> >>>>> +++ b/libavfilter/allfilters.c

> >>>>> @@ -503,7 +503,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;

> >>>>> }

> >>>>> --

> >>>>> 2.21.0

> >>>> LGTM

> >>>

> >>> will apply

> >>>

> >>

> >> Breaks ABI.

> >

> > I don’t get it, would you care to elaborate?

> 

> Ping.

> 


Is this because of :
"9. Change the const or volatile qualifier of a member function"

Some compilers encode the constness of a function in the mangled
name and hence changing the function from const to non-const changes
the mangled name.

https://www.acodersjourney.com/20-abi-breaking-changes/
Zhao Zhili Nov. 6, 2019, 2:41 p.m. UTC | #7
> On Nov 6, 2019, at 10:15 PM, Fu, Linjie <linjie.fu@intel.com> wrote:
> 
>> -----Original Message-----
>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
>> "zhilizhao(???)"
>> Sent: Wednesday, November 6, 2019 21:09
>> To: FFmpeg development discussions and patches <ffmpeg-
>> devel@ffmpeg.org>
>> Subject: Re: [FFmpeg-devel] [PATCH] avfilter: remove useless cast
>> 
>> 
>> 
>>> On Oct 29, 2019, at 10:28 PM, zhilizhao(赵志立) <quinkblack@foxmail.com>
>> wrote:
>>> 
>>> 
>>>> On Oct 29, 2019, at 9:15 PM, Paul B Mahol <onemda@gmail.com> wrote:
>>>> 
>>>> On 10/29/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
>>>>> On Mon, Oct 28, 2019 at 11:18:04AM +0800, mypopy@gmail.com wrote:
>>>>>> On Mon, Oct 28, 2019 at 12:03 AM Zhao Zhili <quinkblack@foxmail.com>
>>>>>> wrote:
>>>>>>> 
>>>>>>> ---
>>>>>>> libavfilter/allfilters.c | 2 +-
>>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>> 
>>>>>>> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>>>>>>> index d136734338..6156066028 100644
>>>>>>> --- a/libavfilter/allfilters.c
>>>>>>> +++ b/libavfilter/allfilters.c
>>>>>>> @@ -503,7 +503,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;
>>>>>>> }
>>>>>>> --
>>>>>>> 2.21.0
>>>>>> LGTM
>>>>> 
>>>>> will apply
>>>>> 
>>>> 
>>>> Breaks ABI.
>>> 
>>> I don’t get it, would you care to elaborate?
>> 
>> Ping.
>> 
> 
> Is this because of :
> "9. Change the const or volatile qualifier of a member function"
> 
> Some compilers encode the constness of a function in the mangled
> name and hence changing the function from const to non-const changes
> the mangled name.
> 
> https://www.acodersjourney.com/20-abi-breaking-changes/ <https://www.acodersjourney.com/20-abi-breaking-changes/>

It doesn't change the qualifier of function return type or local variable.
And mangle/demangle doesn't matter for C, right?
 
const AVFilter *avfilter_get_by_name(const char *name)
{
    const AVFilter *f = NULL;
    void *opaque = 0;

    if (!name)
        return NULL;

    while ((f = av_filter_iterate(&opaque)))
        if (!strcmp(f->name, name))
            return (AVFilter *)f;

    return NULL;
}


> 
> _______________________________________________
> 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".
diff mbox

Patch

diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index d136734338..6156066028 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -503,7 +503,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;
 }