[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 10:55:48 CEST 2015


On Mon, 27 Apr 2015 09:58:58 +0530
Niklesh Lalwani <niklesh.lalwani at iitb.ac.in> wrote:

> From: Niklesh <niklesh.lalwani at iitb.ac.in>
> 
> Signed-off-by: Niklesh <niklesh.lalwani at iitb.ac.in>
> ---
>  libavcodec/movtextdec.c | 54 +++++++++++++++++++++++++------------------------
>  1 file changed, 28 insertions(+), 26 deletions(-)
> 
> diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> index 3059599..b134ac5 100644
> --- a/libavcodec/movtextdec.c
> +++ b/libavcodec/movtextdec.c

> -    int *style_pos;
> +    int flag, style_pos;


> -                    style_pos = av_malloc(4);
> -                    *style_pos = AV_RB16(tsmb);
> +                    style_pos = AV_RB16(tsmb);
>                      index = i;
> -                    av_dynarray_add(&style_start, &index, style_pos);
> +                    av_dynarray_add(&style_start, &index, (void*)(size_t)style_pos);

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. 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...)


More information about the ffmpeg-devel mailing list