Browse code

Merge commit 'b7e64fba7f37cc0399beae844f0a5dbef9219376'

* commit 'b7e64fba7f37cc0399beae844f0a5dbef9219376':
Reduce the scope of some variables

Merged-by: Clément Bœsch <u@pkh.me>

Clément Bœsch authored on 2016/06/22 05:40:56
Showing 5 changed files
... ...
@@ -827,7 +827,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
827 827
     AVSubtitleRect *rect;
828 828
     DVBSubCLUT *clut;
829 829
     uint32_t *clut_table;
830
-    int i,j;
830
+    int i;
831 831
     int offset_x=0, offset_y=0;
832 832
     int ret = 0;
833 833
 
... ...
@@ -924,10 +924,13 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
924 924
 
925 925
 #if FF_API_AVPICTURE
926 926
 FF_DISABLE_DEPRECATION_WARNINGS
927
+{
928
+            int j;
927 929
             for (j = 0; j < 4; j++) {
928 930
                 rect->pict.data[j] = rect->data[j];
929 931
                 rect->pict.linesize[j] = rect->linesize[j];
930 932
             }
933
+}
931 934
 FF_ENABLE_DEPRECATION_WARNINGS
932 935
 #endif
933 936
 
... ...
@@ -2931,7 +2931,7 @@ int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t s
2931 2931
 
2932 2932
 static int encode_thread(AVCodecContext *c, void *arg){
2933 2933
     MpegEncContext *s= *(void**)arg;
2934
-    int mb_x, mb_y, pdif = 0;
2934
+    int mb_x, mb_y;
2935 2935
     int chr_h= 16>>s->chroma_y_shift;
2936 2936
     int i, j;
2937 2937
     MpegEncContext best_s = { 0 }, backup_s;
... ...
@@ -3569,7 +3569,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
3569 3569
     /* Send the last GOB if RTP */
3570 3570
     if (s->avctx->rtp_callback) {
3571 3571
         int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x;
3572
-        pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob;
3572
+        int pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob;
3573 3573
         /* Call the RTP callback to send the last GOB */
3574 3574
         emms_c();
3575 3575
         s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb);
... ...
@@ -529,8 +529,6 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
529 529
     }
530 530
     for (i = 0; i < ctx->presentation.object_count; i++) {
531 531
         PGSSubObject *object;
532
-        AVSubtitleRect *rect;
533
-        int j;
534 532
 
535 533
         sub->rects[i]  = av_mallocz(sizeof(*sub->rects[0]));
536 534
         if (!sub->rects[i]) {
... ...
@@ -597,11 +595,15 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
597 597
 
598 598
 #if FF_API_AVPICTURE
599 599
 FF_DISABLE_DEPRECATION_WARNINGS
600
+{
601
+        AVSubtitleRect *rect;
602
+        int j;
600 603
         rect = sub->rects[i];
601 604
         for (j = 0; j < 4; j++) {
602 605
             rect->pict.data[j] = rect->data[j];
603 606
             rect->pict.linesize[j] = rect->linesize[j];
604 607
         }
608
+}
605 609
 FF_ENABLE_DEPRECATION_WARNINGS
606 610
 #endif
607 611
     }
... ...
@@ -57,8 +57,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
57 57
     int64_t packet_time = 0;
58 58
     GetBitContext gb;
59 59
     int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A');
60
-    AVSubtitleRect *rect;
61
-    int j;
62 60
 
63 61
     // check that at least header fits
64 62
     if (buf_size < 27 + 7 * 2 + 4 * (3 + has_alpha)) {
... ...
@@ -134,11 +132,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
134 134
 
135 135
 #if FF_API_AVPICTURE
136 136
 FF_DISABLE_DEPRECATION_WARNINGS
137
+{
138
+    AVSubtitleRect *rect;
139
+    int j;
137 140
     rect = sub->rects[0];
138 141
     for (j = 0; j < 4; j++) {
139 142
         rect->pict.data[j] = rect->data[j];
140 143
         rect->pict.linesize[j] = rect->linesize[j];
141 144
     }
145
+}
142 146
 FF_ENABLE_DEPRECATION_WARNINGS
143 147
 #endif
144 148
 
... ...
@@ -971,9 +971,9 @@ fail:
971 971
 
972 972
 static int v4l2_read_packet(AVFormatContext *ctx, AVPacket *pkt)
973 973
 {
974
-    struct video_data *s = ctx->priv_data;
975 974
 #if FF_API_CODED_FRAME
976 975
 FF_DISABLE_DEPRECATION_WARNINGS
976
+    struct video_data *s = ctx->priv_data;
977 977
     AVFrame *frame = ctx->streams[0]->codec->coded_frame;
978 978
 FF_ENABLE_DEPRECATION_WARNINGS
979 979
 #endif