[FFmpeg-devel] [PATCH 3/3] avutil/tree: add additional const qualifier to the comparator

Ganesh Ajjanagadde gajjanag at mit.edu
Sun Oct 25 18:10:27 CET 2015


On Sun, Oct 25, 2015 at 1:03 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Sun, Oct 25, 2015 at 12:46:31PM -0400, Ganesh Ajjanagadde wrote:
>> On Sun, Oct 25, 2015 at 12:35 PM, Michael Niedermayer
>> <michael at niedermayer.cc> wrote:
>> > On Sat, Oct 24, 2015 at 09:03:03PM -0400, Ganesh Ajjanagadde wrote:
>> >> On Sat, Oct 24, 2015 at 7:17 PM, Henrik Gramner <henrik at gramner.com> wrote:
>> >> > On Sun, Oct 25, 2015 at 12:02 AM, Ganesh Ajjanagadde
>> >> > <gajjanagadde at gmail.com> wrote:
>> >> >> -static int cmp(void *key, const void *node)
>> >> >> +static int cmp(const void *key, const void *node)
>> >> >>  {
>> >> >>      return (*(int64_t *) key) - ((const CacheEntry *) node)->logical_pos;
>> >> >>  }
>> >> >
>> >> >> -int ff_nut_sp_pos_cmp(const Syncpoint *a, const Syncpoint *b)
>> >> >> +int ff_nut_sp_pos_cmp(const void *a, const void *b)
>> >> >>  {
>> >> >> -    return ((a->pos - b->pos) >> 32) - ((b->pos - a->pos) >> 32);
>> >> >> +    Syncpoint va = *(Syncpoint *)a, vb = *(Syncpoint *)b;
>> >> >> +    return ((va.pos - vb.pos) >> 32) - ((vb.pos - va.pos) >> 32);
>> >> >>  }
>> >> >
>> >> >> -int ff_nut_sp_pts_cmp(const Syncpoint *a, const Syncpoint *b)
>> >> >> +int ff_nut_sp_pts_cmp(const void *a, const void *b)
>> >> >>  {
>> >> >> -    return ((a->ts - b->ts) >> 32) - ((b->ts - a->ts) >> 32);
>> >> >> +    Syncpoint va = *(Syncpoint *)a, vb = *(Syncpoint *)b;
>> >> >> +    return ((va.ts - vb.ts) >> 32) - ((vb.ts - va.ts) >> 32);
>> >> >>  }
>> >> >
>> >> > Casts discards const qualifiers.
>> >>
>> >> Good catch, changed. There is some more such constness being discarded
>> >> in comparators, and some needlessly complex comparator logic in some
>> >> places. Submitted a patch.
>> >>
>> >> >
>> >> > Furthermore, why are you changing the two last functions to copy the
>> >> > entire struct to a temporary local copy?
>> >>
>> >> Sorry, forgot they were structs.
>> >> Fixed all, pushed. Thanks.
>> >
>> > i think this results in some new warnings for the tree test build
>> >
>> > libavutil/tree.c: In function ‘main’:
>> > libavutil/tree.c:238:9: warning: passing argument 3 of ‘av_tree_insert’ from incompatible pointer type [enabled by default]
>> > libavutil/tree.c:59:7: note: expected ‘int (*)(const void *, const void *)’ but argument is of type ‘int (*)(void *, const void *)’
>> > libavutil/tree.c:244:13: warning: passing argument 3 of ‘av_tree_insert’ from incompatible pointer type [enabled by default]
>> > libavutil/tree.c:59:7: note: expected ‘int (*)(const void *, const void *)’ but argument is of type ‘int (*)(void *, const void *)’
>> > libavutil/tree.c:245:13: warning: passing argument 3 of ‘av_tree_find’ from incompatible pointer type [enabled by default]
>>
>> Easy fix, and pushed. Sorry.
>
>> BTW, how did you enable the test build?
>
> make libavutil/tree-test
> or
> make fate
>
> builds it

Thanks.
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
> questions about the command line tools should be sent to the ffmpeg-user ML.
> And questions about how to use libav* should be sent to the libav-user ML.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list