[FFmpeg-cvslog] Avoid C99 variable declarations within for statements.

Diego Biurrun git at videolan.org
Fri Jun 15 00:19:10 CEST 2012


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Thu Jun 14 10:19:06 2012 +0200| [d246c18ea6dca4dbdc92aec6ae4e3e038999a709] | committer: Diego Biurrun

Avoid C99 variable declarations within for statements.

We generally do not declare variables within for statements and
there are compilers that choke on such constructs.

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

 avplay.c             |    6 +++---
 libavcodec/pthread.c |    3 ++-
 libavdevice/dv1394.h |    3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/avplay.c b/avplay.c
index c01e446..e9389ff 100644
--- a/avplay.c
+++ b/avplay.c
@@ -2608,13 +2608,13 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
 
 static void toggle_full_screen(void)
 {
-    is_full_screen = !is_full_screen;
 #if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14)
     /* OS X needs to empty the picture_queue */
-    for (int i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {
+    int i;
+    for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++)
         cur_stream->pictq[i].reallocate = 1;
-    }
 #endif
+    is_full_screen = !is_full_screen;
     video_open(cur_stream);
 }
 
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 88d8ade..c7edb9e 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -865,6 +865,7 @@ error:
 
 void ff_thread_flush(AVCodecContext *avctx)
 {
+    int i;
     FrameThreadContext *fctx = avctx->thread_opaque;
 
     if (!avctx->thread_opaque) return;
@@ -880,7 +881,7 @@ void ff_thread_flush(AVCodecContext *avctx)
     fctx->next_decoding = fctx->next_finished = 0;
     fctx->delaying = 1;
     fctx->prev_thread = NULL;
-    for (int i = 0; i < avctx->thread_count; i++) {
+    for (i = 0; i < avctx->thread_count; i++) {
         PerThreadContext *p = &fctx->threads[i];
         // Make sure decode flush calls with size=0 won't return old frames
         p->got_frame = 0;
diff --git a/libavdevice/dv1394.h b/libavdevice/dv1394.h
index 5ccc68a..fc4df24 100644
--- a/libavdevice/dv1394.h
+++ b/libavdevice/dv1394.h
@@ -175,7 +175,8 @@
          if(status.dropped_frames > 0) {
               reset_dv1394();
          } else {
-              for(int i = 0; i < status.n_clear_frames; i++) {
+              int i;
+              for (i = 0; i < status.n_clear_frames; i++) {
                   copy_DV_frame();
               }
          }



More information about the ffmpeg-cvslog mailing list