[FFmpeg-devel] [PATCH] Disable puts and change it to av_log

Michael Niedermayer michaelni
Wed Jan 16 23:12:29 CET 2008


On Wed, Jan 16, 2008 at 10:40:31PM +0100, Diego Biurrun wrote:
> On Wed, Jan 16, 2008 at 09:15:51PM +0100, Michael Niedermayer wrote:
> > On Wed, Jan 16, 2008 at 07:55:33PM +0100, Sigbj?rn Skj?ret wrote:
> > > puts.diffs changes puts() to av_log() and puts2.diffs makes sure any further
> > > use of puts will fail to link.
> > 
> > you missed libavcodec/mace.c
> > 
> > either way
> > patches ok
> 
> Here is a version with mace.c.
> 
> Diego

> Index: libavformat/gif.c
> ===================================================================
> --- libavformat/gif.c	(revision 11540)
> +++ libavformat/gif.c	(working copy)
> @@ -137,7 +137,7 @@
>          //printf("bitbuf = %08x\n", bit_buf);
>          s->buf_ptr+=4;
>          if (s->buf_ptr >= s->buf_end)
> -            puts("bit buffer overflow !!"); // should never happen ! who got rid of the callback ???
> +            av_log(NULL,AV_LOG_WARNING,"bit buffer overflow !!"); // should never happen ! who got rid of the callback ???
>  //            flush_buffer_rev(s);
>          bit_cnt=bit_cnt + n - 32;
>          if (bit_cnt == 0) {
> Index: libavcodec/gif.c
> ===================================================================
> --- libavcodec/gif.c	(revision 11540)
> +++ libavcodec/gif.c	(working copy)
> @@ -136,7 +136,7 @@
>  
>          //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 ???
> +            av_log(NULL,AV_LOG_WARNING,"bit buffer overflow !!"); // should never happen ! who got rid of the callback ???

after reading this again these should be abort()s

anyway this code is a mess (all the gif_put_bit should be removed)


>  //            flush_buffer_rev(s);
>          bit_cnt=bit_cnt + n - 32;
>          if (bit_cnt == 0) {
> Index: libavcodec/mace.c
> ===================================================================
> --- libavcodec/mace.c	(revision 11540)
> +++ libavcodec/mace.c	(working copy)
> @@ -410,7 +410,7 @@
>      switch (avctx->codec->id) {
>      case CODEC_ID_MACE3:
>  #ifdef DEBUG
> -puts("mace_decode_frame[3]()");
> +        av_log(avctx,AV_LOG_DEBUG,"mace_decode_frame[3]()");
>  #endif

dprintf


>          Exp1to3(c, buf, samples, buf_size / 2 / avctx->channels, avctx->channels, 1);
>          if (avctx->channels == 2)
> @@ -419,7 +419,7 @@
>          break;
>      case CODEC_ID_MACE6:
>  #ifdef DEBUG
> -puts("mace_decode_frame[6]()");
> +        av_log(avctx,AV_LOG_DEBUG, "mace_decode_frame[6]()");
>  #endif

dprintf


>          Exp1to6(c, buf, samples, buf_size / avctx->channels, avctx->channels, 1);
>          if (avctx->channels == 2)

> Index: libavutil/internal.h
> ===================================================================
> --- libavutil/internal.h	(revision 11540)
> +++ libavutil/internal.h	(working copy)
> @@ -257,6 +257,8 @@
>  #define printf please_use_av_log
>  #undef  fprintf
>  #define fprintf please_use_av_log
> +#undef  puts
> +#define puts please_use_av_log
>  #undef  perror

ok

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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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-devel/attachments/20080116/91f1a450/attachment.pgp>



More information about the ffmpeg-devel mailing list