[FFmpeg-devel] [PATCH] work around some 'may be used uninitialized warnings'

Benoit Fouet benoit.fouet
Tue Mar 3 14:41:13 CET 2009


Hi,

On 03/03/2009 02:28 PM, Diego Biurrun wrote:
> Here is a patch to work around the 'may be used uninitialized warnings'
> in libavformat, please review.  I will commit individual parts if OKed,
> not before.
>
> A bunch of these warnings seem to be legitimate.  I initialized these
> variables to 0, but probably somebody should have a closer look at the
> code.
>
>   

> Index: libavformat/rmdec.c
> ===================================================================
> --- libavformat/rmdec.c    (revision 17759)
> +++ libavformat/rmdec.c    (working copy)
> @@ -482,7 +482,7 @@
>                                     RMDemuxContext *rm, RMStream *vst,
>                                     AVPacket *pkt, int len)
>  {
> -    int hdr, seq, pic_num, len2, pos;
> +    int hdr, seq=0, pic_num=0, len2=0, av_uninit(pos);
>      int type;
> 
>      hdr = get_byte(pb); len--;
>

from what I read, they should all be av_uninit, no initialization is
needed, as type can only be 0, 1, 2 or 3.


> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c    (revision 17759)
> +++ libavformat/utils.c    (working copy)
> @@ -1289,7 +1289,7 @@
> 
>  int av_seek_frame_binary(AVFormatContext *s, int stream_index,
int64_t target_ts, int flags){
>      AVInputFormat *avif= s->iformat;
> -    int64_t pos_min, pos_max, pos, pos_limit;
> +    int64_t pos_min=0, pos_max=0, pos, pos_limit;
>      int64_t ts_min, ts_max, ts;
>      int index;
>      AVStream *st;
>

I had a look at this one once, and it appears that they are not used
uninitialized, if you know how av_gen_search() works

Ben




More information about the ffmpeg-devel mailing list