[FFmpeg-cvslog] lavc/ccaption_dec: check for bprint completeness outside the loop

Clément Bœsch git at videolan.org
Sat Jan 9 12:41:25 CET 2016


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sat Jan  9 12:40:28 2016 +0100| [22765140fa676041a786e5973b11199badfa367c] | committer: Clément Bœsch

lavc/ccaption_dec: check for bprint completeness outside the loop

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

 libavcodec/ccaption_dec.c |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index e84c480..da7fb37 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -283,7 +283,6 @@ static void roll_up(CCaptionSubContext *ctx)
 static int capture_screen(CCaptionSubContext *ctx)
 {
     int i;
-    int ret = 0;
     struct Screen *screen = ctx->screen + ctx->active_screen;
     enum cc_font prev_font = CCFONT_REGULAR;
     av_bprint_clear(&ctx->buffer);
@@ -330,25 +329,19 @@ static int capture_screen(CCaptionSubContext *ctx)
                     }
                 }
                 prev_font = font[j];
-
                 av_bprintf(&ctx->buffer, "%s%s%c", e_tag, s_tag, row[j]);
             }
-
             av_bprintf(&ctx->buffer, "\\N");
-            ret = av_bprint_is_complete(&ctx->buffer);
-            if (ret == 0) {
-                ret = AVERROR(ENOMEM);
-                break;
-            }
         }
-
     }
+    if (!av_bprint_is_complete(&ctx->buffer))
+        return AVERROR(ENOMEM);
     if (screen->row_used && ctx->buffer.len >= 2) {
         ctx->buffer.len -= 2;
         ctx->buffer.str[ctx->buffer.len] = 0;
     }
     ctx->buffer_changed = 1;
-    return ret;
+    return 0;
 }
 
 static int reap_screen(CCaptionSubContext *ctx, int64_t pts)



More information about the ffmpeg-cvslog mailing list