[FFmpeg-cvslog] Fix non-C89 declarations in for loops

Mans Rullgard git at videolan.org
Tue Jan 31 03:36:04 CET 2012


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sun Jan 29 20:55:10 2012 +0000| [3715d841a619f1cbc4776d9b00575dae6fb6534a] | committer: Mans Rullgard

Fix non-C89 declarations in for loops

Some compilers still do not support this syntax.

Signed-off-by: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3715d841a619f1cbc4776d9b00575dae6fb6534a
---

 avconv.c            |    4 ++--
 libavcodec/aacenc.c |    6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/avconv.c b/avconv.c
index 77d6648..a6f0838 100644
--- a/avconv.c
+++ b/avconv.c
@@ -421,7 +421,7 @@ static int alloc_buffer(InputStream *ist, FrameBuffer **pbuf)
 {
     AVCodecContext *s = ist->st->codec;
     FrameBuffer  *buf = av_mallocz(sizeof(*buf));
-    int ret;
+    int i, ret;
     const int pixel_size = av_pix_fmt_descriptors[s->pix_fmt].comp[0].step_minus1+1;
     int h_chroma_shift, v_chroma_shift;
     int edge = 32; // XXX should be avcodec_get_edge_width(), but that fails on svq1
@@ -449,7 +449,7 @@ static int alloc_buffer(InputStream *ist, FrameBuffer **pbuf)
     memset(buf->base[0], 128, ret);
 
     avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
-    for (int i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
+    for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {
         const int h_shift = i==0 ? 0 : h_chroma_shift;
         const int v_shift = i==0 ? 0 : v_chroma_shift;
         if (s->flags & CODEC_FLAG_EMU_EDGE)
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index e610a80..1957420 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -223,8 +223,9 @@ WINDOW_FUNC(eight_short)
     const float *pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
     const float *in = audio + 448;
     float *out = sce->ret;
+    int w;
 
-    for (int w = 0; w < 8; w++) {
+    for (w = 0; w < 8; w++) {
         dsp->vector_fmul        (out, in, w ? pwindow : swindow, 128);
         out += 128;
         in  += 128;
@@ -686,11 +687,12 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
 
 static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s)
 {
+    int ch;
     FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail);
     FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail);
     FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail);
 
-    for(int ch = 0; ch < s->channels; ch++)
+    for(ch = 0; ch < s->channels; ch++)
         s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch;
 
     return 0;



More information about the ffmpeg-cvslog mailing list