summaryrefslogtreecommitdiff
path: root/libavcodec/ccaption_dec.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2016-01-09 12:40:28 +0100
committerClément Bœsch <u@pkh.me>2016-01-09 12:40:50 +0100
commit22765140fa676041a786e5973b11199badfa367c (patch)
tree9f2b3080fa10181c63764a112720de29ffde5b74 /libavcodec/ccaption_dec.c
parent31bff21d2c0696cc1fb6aaeb6aff1090f8fced8f (diff)
lavc/ccaption_dec: check for bprint completeness outside the loop
Diffstat (limited to 'libavcodec/ccaption_dec.c')
-rw-r--r--libavcodec/ccaption_dec.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index e84c4800c8..da7fb37671 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)