avcodec/ttmlenc: Use string literal macro for default namespacing

Fixes -Werror=format-security build failures when building with
disabled optimizations and (according to fate.ffmpeg.org also with
several other old GCC versions).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
pull/388/head
Andreas Rheinhardt 2 years ago
parent e725c5e24e
commit 1368b5a725
  1. 2
      libavcodec/ttmlenc.c
  2. 10
      libavcodec/ttmlenc.h
  3. 2
      libavformat/ttmlenc.c

@ -315,7 +315,7 @@ static int ttml_write_header_content(AVCodecContext *avctx)
} }
// write the first string in extradata, attributes in the base "tt" element. // write the first string in extradata, attributes in the base "tt" element.
av_bprintf(&s->buffer, ttml_default_namespacing); av_bprintf(&s->buffer, TTML_DEFAULT_NAMESPACING);
// the cell resolution is in character cells, so not exactly 1:1 against // the cell resolution is in character cells, so not exactly 1:1 against
// a pixel based resolution, but as the tts:extent in the root // a pixel based resolution, but as the tts:extent in the root
// "tt" element is frowned upon (and disallowed in the EBU-TT profile), // "tt" element is frowned upon (and disallowed in the EBU-TT profile),

@ -25,10 +25,10 @@
#define TTMLENC_EXTRADATA_SIGNATURE "lavc-ttmlenc" #define TTMLENC_EXTRADATA_SIGNATURE "lavc-ttmlenc"
#define TTMLENC_EXTRADATA_SIGNATURE_SIZE (sizeof(TTMLENC_EXTRADATA_SIGNATURE) - 1) #define TTMLENC_EXTRADATA_SIGNATURE_SIZE (sizeof(TTMLENC_EXTRADATA_SIGNATURE) - 1)
static const char *const ttml_default_namespacing = #define TTML_DEFAULT_NAMESPACING \
" xmlns=\"http://www.w3.org/ns/ttml\"\n" " xmlns=\"http://www.w3.org/ns/ttml\"\n" \
" xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\"\n" " xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\"\n" \
" xmlns:tts=\"http://www.w3.org/ns/ttml#styling\"\n" " xmlns:tts=\"http://www.w3.org/ns/ttml#styling\"\n" \
" xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\"\n"; " xmlns:ttp=\"http://www.w3.org/ns/ttml#parameter\"\n"
#endif /* AVCODEC_TTMLENC_H */ #endif /* AVCODEC_TTMLENC_H */

@ -91,7 +91,7 @@ static int ttml_set_header_values_from_extradata(
if (!additional_data_size) { if (!additional_data_size) {
// simple case, we don't have to go through local_params and just // simple case, we don't have to go through local_params and just
// set default fall-back values (for old extradata format). // set default fall-back values (for old extradata format).
header_params->tt_element_params = ttml_default_namespacing; header_params->tt_element_params = TTML_DEFAULT_NAMESPACING;
header_params->pre_body_elements = ""; header_params->pre_body_elements = "";
return 0; return 0;

Loading…
Cancel
Save