[Ffmpeg-devel] [PATCH] Fix some gcc warnings

Aurelien Jacobs aurel
Wed Sep 21 23:40:24 CEST 2005


On Wed, 21 Sep 2005 22:12:18 +0100
M?ns Rullg?rd <mru at inprovide.com> wrote:

> Aurelien Jacobs <aurel at gnuage.org> writes:
> 
> > On Wed, 21 Sep 2005 10:28:00 +0100 (BST)
> > M?ns Rullg?rd <mru at inprovide.com> wrote:
> >
> >> 
> >> Colin Ward said:
> >> >
> >> > Michel Bardiaux wrote:
> >> >>
> >> >
> >> >    [Snip]
> >> >
> >> >    Yay!
> >> >
> >> >    I noticed that FFMPEG can be a little noisy to compile.  Lots
> >of > > "unused variable" type warnings.  I was wondering if people
> >would be > > interested in patches for these.  Should I submit some
> >or are people > > not really worried?
> >> 
> >> I thought I had cleaned up most of those.
> >
> > That's true. But there are still some of them left, especially in
> > snow.c. Attached a patch which fixes all the remaining "unused
> > variable" I had with my config.
> >
> > Also note that the patch which initiated this thread don't fix
> > "unused variable". It in fact fixes "assignment makes pointer from
> > integer without a cast" in bitstream.h which is included in a lot of
> > files, and so which causes warnings all along the build.
> 
> Are you using gcc 4, or some extra pedantic flags?  I don't see those
> warnings.

Oh, sure, I should have mentioned that I use gcc 4 !
And that I also get tons of warnings about pointers which differ
in signedness. I may try to workaround those too...

> > So I think this patch is really desirable, and I'm willing to apply
> > it if no one protest.
> 
> Just make sure none of the variables are used under some #ifdef, but
> that doesn't appear to be the case here.

Yes, I verified. There was some in snow.c, so I moved them in the #if 0
block.

> > Index: libavcodec/oggvorbis.c
> > ===================================================================
> > RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/oggvorbis.c,v
> > retrieving revision 1.23
> > diff -u -r1.23 oggvorbis.c
> > --- libavcodec/oggvorbis.c	4 Sep 2005 09:04:52 -0000	1.23
> > +++ libavcodec/oggvorbis.c	21 Sep 2005 20:34:55 -0000
> > @@ -294,7 +294,7 @@
> >      OggVorbisContext *context = avccontext->priv_data ;
> >      float **pcm ;
> >      ogg_packet *op= &context->op;    
> > -    int samples, total_samples, total_bytes,i;
> > +    int samples, total_samples, total_bytes;
> >   
> >      if(!buf_size){
> >      //FIXME flush
> 
> Seems OK to me.
> 
> > Index: libavcodec/snow.c
> > ===================================================================
> > RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/snow.c,v
> > retrieving revision 1.62
> > diff -u -r1.62 snow.c
> > --- libavcodec/snow.c	21 Aug 2005 22:17:41 -0000	1.62
> > +++ libavcodec/snow.c	21 Sep 2005 20:34:56 -0000
> 
> I didn't touch snow last time around, since it is fairly actively
> worked on, and I didn't want to disrupt any work in progress.

Hum... somewhat true. But there wasn't lots of commits in snow.c
since quite some time. Moreover, removed variables should be
really harmless (mostly some 'i').
Michael, are you ok with this ?

> > Index: libavcodec/vc9.c
> > ===================================================================
> > RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/vc9.c,v
> > retrieving revision 1.23
> > diff -u -r1.23 vc9.c
> > --- libavcodec/vc9.c	2 Jul 2005 19:28:32 -0000	1.23
> > +++ libavcodec/vc9.c	21 Sep 2005 20:34:57 -0000
> 
> Likewise, although there hasn't been much activity recently.

And I didn't removed the variable, only commented it, so it should
be safe.

> > Index: libavformat/ogg.c
> > ===================================================================
> > RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/ogg.c,v
> > retrieving revision 1.24
> > diff -u -r1.24 ogg.c
> > --- libavformat/ogg.c	15 Aug 2005 20:42:56 -0000	1.24
> > +++ libavformat/ogg.c	21 Sep 2005 20:35:03 -0000
> > @@ -34,7 +34,7 @@
> >  {
> >      OggContext *context = avfcontext->priv_data;
> >      ogg_packet *op= &context->op;    
> > -    int n, i;
> > +    int n;
> >  
> >      ogg_stream_init(&context->os, 31415);
> >      
> > @@ -44,7 +44,7 @@
> >          int headers_len = codec->extradata_size;
> >          uint8_t *header_start[3];
> >          int header_len[3];
> > -        int i, j, hdr_type;
> > +        int i, j;
> >          
> >          av_set_pts_info(avfcontext->streams[n], 60, 1,
> >          AV_TIME_BASE);
> 
> OK.

I will commit if Michael agree with the snow.c part.

Aurel





More information about the ffmpeg-devel mailing list