[FFmpeg-cvslog] r11546 - in trunk: libavcodec/gif.c libavformat/gif.c

Michael Niedermayer michaelni
Thu Jan 17 03:55:36 CET 2008


On Wed, Jan 16, 2008 at 06:49:43PM -0800, Mike Melanson wrote:
> Rich Felker wrote:
> > On Thu, Jan 17, 2008 at 01:12:05AM +0100, michael wrote:
> >> Author: michael
> >> Date: Thu Jan 17 01:12:04 2008
> >> New Revision: 11546
> >>
> >> Log:
> >> Replace idiotic (what moron wrote that code?) "buffer overflow" message by
> >> abort()
> >>
> >>
> >> Modified:
> >>    trunk/libavcodec/gif.c
> >>    trunk/libavformat/gif.c
> >>
> >> Modified: trunk/libavcodec/gif.c
> >> ==============================================================================
> >> --- trunk/libavcodec/gif.c	(original)
> >> +++ trunk/libavcodec/gif.c	Thu Jan 17 01:12:04 2008
> >> @@ -136,7 +136,7 @@ static void gif_put_bits_rev(PutBitConte
> >>  
> >>          //printf("bitbuf = %08x\n", bit_buf);
> >>          if (s->buf_ptr >= s->buf_end)
> >> -            puts("bit buffer overflow !!"); // should never happen ! who got rid of the callback ???
> >> +            abort();
> > 
> > If it can't happen, change it to assert(s->buf_ptr < s->buf_end).
> > If it can happen, it needs to be handled. abort() is not a way of
> > handling it.
> 
> Sure enough. I was about to demand to know how this change got approved
> until I noticed that Michael submitted it himself. :) I think the more
> traditional solution (at least, the one that I used in many decoders) is
> to return early from the current function if the decode can not proceed
> further.

Its a encoder not a decoder.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20080117/c7c0e557/attachment.pgp>



More information about the ffmpeg-cvslog mailing list