]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/assdec.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / assdec.c
index 3178f2953ca6a73a8a641aca7995ab400af40b53..3b1a119496942ffcdaa1c05116cc9d09a2203371 100644 (file)
@@ -31,7 +31,8 @@ static av_cold int ass_decode_init(AVCodecContext *avctx)
     avctx->subtitle_header = av_malloc(avctx->extradata_size + 1);
     if (!avctx->subtitle_header)
         return AVERROR(ENOMEM);
-    memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
+    if (avctx->extradata_size)
+        memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
     avctx->subtitle_header[avctx->extradata_size] = 0;
     avctx->subtitle_header_size = avctx->extradata_size;
     return 0;
@@ -61,7 +62,7 @@ static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
 }
 
 #if CONFIG_SSA_DECODER
-AVCodec ff_ssa_decoder = {
+const AVCodec ff_ssa_decoder = {
     .name         = "ssa",
     .long_name    = NULL_IF_CONFIG_SMALL("ASS (Advanced SubStation Alpha) subtitle"),
     .type         = AVMEDIA_TYPE_SUBTITLE,
@@ -72,7 +73,7 @@ AVCodec ff_ssa_decoder = {
 #endif
 
 #if CONFIG_ASS_DECODER
-AVCodec ff_ass_decoder = {
+const AVCodec ff_ass_decoder = {
     .name         = "ass",
     .long_name    = NULL_IF_CONFIG_SMALL("ASS (Advanced SubStation Alpha) subtitle"),
     .type         = AVMEDIA_TYPE_SUBTITLE,