[FFmpeg-cvslog] lavf/hlsenc: Do not mix declarations and code.

Carl Eugen Hoyos git at videolan.org
Tue Jan 7 18:38:43 EET 2020


ffmpeg | branch: release/4.1 | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Fri Nov 16 22:03:37 2018 +0100| [4521700f295f35da4768f88b570e0836a858ce7b] | committer: Michael Niedermayer

lavf/hlsenc: Do not mix declarations and code.

Fixes the following warnings:
libavformat/hlsenc.c: In function 'hls_write_trailer':
libavformat/hlsenc.c:2364:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
                 uint8_t *buffer = NULL;
                 ^~~~~~~
libavformat/hlsenc.c:2372:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
                 int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
                 ^~~
libavformat/hlsenc.c:2379:13: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
             int range_length = 0;
             ^~~

(cherry picked from commit fc94e9704e056a2dc85745ffec685ffb6fcd142e)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/hlsenc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index f8f060d065..fa45a62844 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2348,26 +2348,26 @@ static int hls_write_trailer(struct AVFormatContext *s)
             return AVERROR(ENOMEM);
         }
         if ( hls->segment_type == SEGMENT_TYPE_FMP4) {
+            int range_length = 0;
             if (!vs->init_range_length) {
+                uint8_t *buffer = NULL;
+                int range_length, byterange_mode;
                 av_write_frame(vs->avf, NULL); /* Flush any buffered data */
                 avio_flush(oc->pb);
 
-                uint8_t *buffer = NULL;
-                int range_length = avio_close_dyn_buf(oc->pb, &buffer);
+                range_length = avio_close_dyn_buf(oc->pb, &buffer);
                 avio_write(vs->out, buffer, range_length);
                 av_free(buffer);
                 vs->init_range_length = range_length;
                 avio_open_dyn_buf(&oc->pb);
                 vs->packets_written = 0;
                 vs->start_pos = range_length;
-                int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
+                byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
                 if (!byterange_mode) {
                     ff_format_io_close(s, &vs->out);
                     hlsenc_io_close(s, &vs->out, vs->base_output_dirname);
                 }
             }
-
-            int range_length = 0;
             if (!(hls->flags & HLS_SINGLE_FILE)) {
                 ret = hlsenc_io_open(s, &vs->out, vs->avf->url, NULL);
                 if (ret < 0) {



More information about the ffmpeg-cvslog mailing list