[FFmpeg-cvslog] ass: use av_asprintf() instead of a temporary stack buffer.

Clément Bœsch git at videolan.org
Mon Jan 30 23:32:40 CET 2012


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sat Jan 28 18:13:07 2012 +0100| [7c0d30b57b5fe141df068767aad26c1c1bcc948f] | committer: Clément Bœsch

ass: use av_asprintf() instead of a temporary stack buffer.

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

 libavcodec/ass.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/libavcodec/ass.c b/libavcodec/ass.c
index cb0babf..8c94d72 100644
--- a/libavcodec/ass.c
+++ b/libavcodec/ass.c
@@ -29,9 +29,7 @@ int ff_ass_subtitle_header(AVCodecContext *avctx,
                            int bold, int italic, int underline,
                            int alignment)
 {
-    char header[512];
-
-    snprintf(header, sizeof(header),
+    avctx->subtitle_header = av_asprintf(
              "[Script Info]\r\n"
              "ScriptType: v4.00+\r\n"
              "\r\n"
@@ -44,7 +42,6 @@ int ff_ass_subtitle_header(AVCodecContext *avctx,
              font, font_size, color, color, back_color, back_color,
              -bold, -italic, -underline, alignment);
 
-    avctx->subtitle_header = av_strdup(header);
     if (!avctx->subtitle_header)
         return AVERROR(ENOMEM);
     avctx->subtitle_header_size = strlen(avctx->subtitle_header);



More information about the ffmpeg-cvslog mailing list