From 99f5fef0ea5671d41fb7b737fbc3e4236542a757 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 10 Jun 2014 23:56:05 +0200 Subject: Add more const While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need. --- sub/ass_mp.c | 2 +- sub/dec_sub.c | 2 +- sub/find_subfiles.c | 6 +++--- sub/osd.c | 2 +- sub/sd_microdvd.c | 2 +- sub/sd_srt.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sub') diff --git a/sub/ass_mp.c b/sub/ass_mp.c index d417912826..a4a22b61a6 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -222,7 +222,7 @@ void mp_ass_render_frame(ASS_Renderer *renderer, ASS_Track *track, double time, *parts = res->parts; } -static int map_ass_level[] = { +static const int map_ass_level[] = { MSGL_ERR, // 0 "FATAL errors" MSGL_WARN, MSGL_INFO, diff --git a/sub/dec_sub.c b/sub/dec_sub.c index ccaf64b471..9fc3997af1 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -41,7 +41,7 @@ extern const struct sd_functions sd_microdvd; extern const struct sd_functions sd_lavf_srt; extern const struct sd_functions sd_lavc_conv; -static const struct sd_functions *sd_list[] = { +static const struct sd_functions *const sd_list[] = { #if HAVE_LIBASS &sd_ass, #endif diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c index 2d03300eaf..a8d6348fe9 100644 --- a/sub/find_subfiles.c +++ b/sub/find_subfiles.c @@ -13,9 +13,9 @@ #include "common/common.h" #include "sub/find_subfiles.h" -static const char *sub_exts[] = {"utf", "utf8", "utf-8", "idx", "sub", "srt", - "smi", "rt", "txt", "ssa", "aqt", "jss", - "js", "ass", NULL}; +static const char *const sub_exts[] = {"utf", "utf8", "utf-8", "idx", "sub", "srt", + "smi", "rt", "txt", "ssa", "aqt", "jss", + "js", "ass", NULL}; static bool is_sub_ext(bstr ext) { diff --git a/sub/osd.c b/sub/osd.c index 8da9fd0756..8b19428e5d 100644 --- a/sub/osd.c +++ b/sub/osd.c @@ -55,7 +55,7 @@ static const struct osd_style_opts osd_style_opts_def = { #define OPT_BASE_STRUCT struct osd_style_opts const struct m_sub_options osd_style_conf = { - .opts = (m_option_t[]) { + .opts = (const m_option_t[]) { OPT_STRING("font", font, 0), OPT_FLOATRANGE("font-size", font_size, 0, 1, 9000), OPT_COLOR("color", color, 0), diff --git a/sub/sd_microdvd.c b/sub/sd_microdvd.c index e9c7a788bc..6e6a9c31a8 100644 --- a/sub/sd_microdvd.c +++ b/sub/sd_microdvd.c @@ -309,7 +309,7 @@ static void convert_microdvd(const char *orig, char *dest, int dest_buffer_size) new_line.buf[new_line.len] = 0; } -static const char *microdvd_ass_extradata = +static const char *const microdvd_ass_extradata = "[Script Info]\n" "ScriptType: v4.00+\n" "PlayResX: 384\n" diff --git a/sub/sd_srt.c b/sub/sd_srt.c index 18ef0cce8f..733a27d0f4 100644 --- a/sub/sd_srt.c +++ b/sub/sd_srt.c @@ -439,7 +439,7 @@ static void convert_subrip(struct sd *sd, const char *orig, new_line.buf[new_line.len] = 0; } -static const char *srt_ass_extradata = +static const char *const srt_ass_extradata = "[Script Info]\n" "ScriptType: v4.00+\n" "PlayResX: 384\n" -- cgit v1.2.3