[FFmpeg-devel] [PATCH] Using size_t* instead of int** for dynarrays and add support for large boxes

wm4 nfxjfg at googlemail.com
Mon Apr 27 13:56:41 CEST 2015

On Mon, 27 Apr 2015 17:18:31 +0530
Niklesh Lalwani <lalwani1994 at gmail.com> wrote:

> >
> > On Mon, Apr 27, 2015 at 2:25 PM, wm4 <nfxjfg at googlemail.com> wrote:
> >
> > This looks hacky. av_dynarray_add() is supposed to many an array of
> > pointers, and here you twist it enough to reinterpret-cast an int to a
> > pointer.
> >
> > Yes, this looks hacky. Earlier I was using int **number, passing address
> of element to add, and then using *number[i] to get the value of the
> element as you can see in the patch.
> > I think av_dynarray2_add() might be the correct function to
> > use here. Then your array can actually be an array of ints.
> > (These dynarray functions are really a mess...)
> > _______________________________________________
> >
> > I can try av_dynarray2_add(). Which one of these three do you think will
> be a better choice?

av_dynarray2_add() IMHO. You'd pass it sizeof(size_t) as element size,
and a size_t* as element pointer.

The way you did it with av_dynarray_add() is not completely wrong, but
I think it obfuscates the code. Actually, there was something that is
not ok with strict C rules: your array had size_t elemtents, not void*
elements (as the function expects).

By the way, your email client add a quote ("> ") before everything you
write. You probably have to add an extra new line, or the mail client
tries to be too clever and thinks what you write belongs to the email
you're replying to.

More information about the ffmpeg-devel mailing list