[FFmpeg-devel] [PATCH] [RFC] libavcodec/h264_mp4toannexb_bsf.c: Copy const data

Benoit Fouet benoit.fouet
Mon Feb 16 16:48:11 CET 2009


Hi,

On 02/16/2009 04:38 PM, Patrik Kullman wrote:
> Gets rid of warning:
> libavcodec/h264_mp4toannexb_bsf.c:61: warning: cast discards qualifiers
> from pointer target type
>
> If this patch is accepted, there are around 31 more const casts that can
> be fixed.
>   

this patch cannot be accepted:

> Index: libavcodec/h264_mp4toannexb_bsf.c
> ===================================================================
> --- libavcodec/h264_mp4toannexb_bsf.c	(revision 17373)
> +++ libavcodec/h264_mp4toannexb_bsf.c	(working copy)
> @@ -58,7 +58,7 @@
>  
>      /* nothing to filter */
>      if (!avctx->extradata || avctx->extradata_size < 6) {
> -        *poutbuf = (uint8_t*) buf;
> +        memcpy(*poutbuf, buf, buf_size);
>          *poutbuf_size = buf_size;
>          return 0;
>      }
> 

you are missing the fact that output buffer is not allocated at that time.
BTW, I don't think copying is a good idea, but the fact that output and input data can be the same should be documented, as already told someone else.

Ben






More information about the ffmpeg-devel mailing list