From 4c1b96c30721f78d9251a8074d4d516c37e755b9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 1 Nov 2008 14:55:23 +0100 Subject: decoder: make the suffixes and mime_types arrays really const The strings were constant, but the pointers weren't. C syntax is somewhat tricky.. --- src/decoder/aac_plugin.c | 4 ++-- src/decoder/audiofile_plugin.c | 4 +++- src/decoder/ffmpeg_plugin.c | 4 ++-- src/decoder/flac_plugin.c | 20 +++++++++++--------- src/decoder/mod_plugin.c | 3 ++- src/decoder/mp3_plugin.c | 4 ++-- src/decoder/mp4_plugin.c | 4 ++-- src/decoder/mpc_plugin.c | 2 +- src/decoder/oggflac_plugin.c | 12 +++++++----- src/decoder/oggvorbis_plugin.c | 12 +++++++----- src/decoder/wavpack_plugin.c | 4 ++-- 11 files changed, 41 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c index 3ae5e3d58..bf4879a19 100644 --- a/src/decoder/aac_plugin.c +++ b/src/decoder/aac_plugin.c @@ -586,8 +586,8 @@ static struct tag *aacTagDup(const char *file) return ret; } -static const char *aac_suffixes[] = { "aac", NULL }; -static const char *aac_mimeTypes[] = { "audio/aac", "audio/aacp", NULL }; +static const char *const aac_suffixes[] = { "aac", NULL }; +static const char *const aac_mimeTypes[] = { "audio/aac", "audio/aacp", NULL }; const struct decoder_plugin aacPlugin = { .name = "aac", diff --git a/src/decoder/audiofile_plugin.c b/src/decoder/audiofile_plugin.c index 9cc87a101..51e1559ce 100644 --- a/src/decoder/audiofile_plugin.c +++ b/src/decoder/audiofile_plugin.c @@ -133,7 +133,9 @@ static struct tag *audiofileTagDup(const char *file) return ret; } -static const char *audiofileSuffixes[] = { "wav", "au", "aiff", "aif", NULL }; +static const char *const audiofileSuffixes[] = { + "wav", "au", "aiff", "aif", NULL +}; const struct decoder_plugin audiofilePlugin = { .name = "audiofile", diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c index e5bd8515b..6f7b2e1e1 100644 --- a/src/decoder/ffmpeg_plugin.c +++ b/src/decoder/ffmpeg_plugin.c @@ -359,14 +359,14 @@ static struct tag *ffmpeg_tag(const char *file) * only that files */ -static const char *ffmpeg_Suffixes[] = { +static const char *const ffmpeg_Suffixes[] = { "wma", "asf", "wmv", "mpeg", "mpg", "avi", "vob", "mov", "qt", "swf", "rm", "swf", "mp1", "mp2", "mp3", "mp4", "m4a", "flac", "ogg", "wav", "au", "aiff", "aif", "ac3", "aac", "mpc", NULL }; //not sure if this is correct... -static const char *ffmpeg_Mimetypes[] = { +static const char *const ffmpeg_Mimetypes[] = { "video/x-ms-asf", "audio/x-ms-wma", "audio/x-ms-wax", diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 8b49ec3e5..05517db27 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -429,11 +429,13 @@ oggflac_try_decode(struct input_stream *inStream) ogg_stream_type_detect(inStream) == FLAC; } -static const char *oggflac_suffixes[] = { "ogg", "oga", NULL }; -static const char *oggflac_mime_types[] = { "audio/x-flac+ogg", - "application/ogg", - "application/x-ogg", - NULL }; +static const char *const oggflac_suffixes[] = { "ogg", "oga", NULL }; +static const char *const oggflac_mime_types[] = { + "audio/x-flac+ogg", + "application/ogg", + "application/x-ogg", + NULL +}; const struct decoder_plugin oggflacPlugin = { .name = "oggflac", @@ -447,10 +449,10 @@ const struct decoder_plugin oggflacPlugin = { #endif /* FLAC_API_VERSION_CURRENT >= 7 */ -static const char *flacSuffixes[] = { "flac", NULL }; -static const char *flac_mime_types[] = { "audio/x-flac", - "application/x-flac", - NULL }; +static const char *const flacSuffixes[] = { "flac", NULL }; +static const char *const flac_mime_types[] = { + "audio/x-flac", "application/x-flac", NULL +}; const struct decoder_plugin flacPlugin = { .name = "flac", diff --git a/src/decoder/mod_plugin.c b/src/decoder/mod_plugin.c index ad6f390a4..d927f0da4 100644 --- a/src/decoder/mod_plugin.c +++ b/src/decoder/mod_plugin.c @@ -263,7 +263,8 @@ static struct tag *modTagDup(const char *file) return ret; } -static const char *modSuffixes[] = { "amf", +static const char *const modSuffixes[] = { + "amf", "dsm", "far", "gdm", diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c index 1dc47b457..528911f3d 100644 --- a/src/decoder/mp3_plugin.c +++ b/src/decoder/mp3_plugin.c @@ -1143,8 +1143,8 @@ static struct tag *mp3_tag_dup(const char *file) return ret; } -static const char *mp3_suffixes[] = { "mp3", "mp2", NULL }; -static const char *mp3_mime_types[] = { "audio/mpeg", NULL }; +static const char *const mp3_suffixes[] = { "mp3", "mp2", NULL }; +static const char *const mp3_mime_types[] = { "audio/mpeg", NULL }; const struct decoder_plugin mp3Plugin = { .name = "mp3", diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c index ae0fe49f9..eeeac8177 100644 --- a/src/decoder/mp4_plugin.c +++ b/src/decoder/mp4_plugin.c @@ -410,8 +410,8 @@ static struct tag *mp4TagDup(const char *file) return ret; } -static const char *mp4_suffixes[] = { "m4a", "mp4", NULL }; -static const char *mp4_mimeTypes[] = { "audio/mp4", "audio/m4a", NULL }; +static const char *const mp4_suffixes[] = { "m4a", "mp4", NULL }; +static const char *const mp4_mimeTypes[] = { "audio/mp4", "audio/m4a", NULL }; const struct decoder_plugin mp4Plugin = { .name = "mp4", diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c index 73b315728..9181c4388 100644 --- a/src/decoder/mpc_plugin.c +++ b/src/decoder/mpc_plugin.c @@ -295,7 +295,7 @@ static struct tag *mpcTagDup(const char *file) return ret; } -static const char *mpcSuffixes[] = { "mpc", NULL }; +static const char *const mpcSuffixes[] = { "mpc", NULL }; const struct decoder_plugin mpcPlugin = { .name = "mpc", diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c index 9fa742548..4ac82c554 100644 --- a/src/decoder/oggflac_plugin.c +++ b/src/decoder/oggflac_plugin.c @@ -337,11 +337,13 @@ fail: return ret; } -static const char *oggflac_Suffixes[] = { "ogg", "oga",NULL }; -static const char *oggflac_mime_types[] = { "audio/x-flac+ogg", - "application/ogg", - "application/x-ogg", - NULL }; +static const char *const oggflac_Suffixes[] = { "ogg", "oga", NULL }; +static const char *const oggflac_mime_types[] = { + "audio/x-flac+ogg", + "application/ogg", + "application/x-ogg", + NULL +}; const struct decoder_plugin oggflacPlugin = { .name = "oggflac", diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c index 4531aac40..14cb48278 100644 --- a/src/decoder/oggvorbis_plugin.c +++ b/src/decoder/oggvorbis_plugin.c @@ -368,11 +368,13 @@ oggvorbis_try_decode(struct input_stream *inStream) return ogg_stream_type_detect(inStream) == VORBIS; } -static const char *oggvorbis_Suffixes[] = { "ogg","oga", NULL }; -static const char *oggvorbis_MimeTypes[] = { "application/ogg", - "audio/x-vorbis+ogg", - "application/x-ogg", - NULL }; +static const char *const oggvorbis_Suffixes[] = { "ogg","oga", NULL }; +static const char *const oggvorbis_MimeTypes[] = { + "application/ogg", + "audio/x-vorbis+ogg", + "application/x-ogg", + NULL +}; const struct decoder_plugin oggvorbisPlugin = { .name = "oggvorbis", diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c index c0fb8898d..ef2ea6a99 100644 --- a/src/decoder/wavpack_plugin.c +++ b/src/decoder/wavpack_plugin.c @@ -559,8 +559,8 @@ wavpack_filedecode(struct decoder *decoder, const char *fname) return true; } -static char const *wavpackSuffixes[] = { "wv", NULL }; -static char const *wavpackMimeTypes[] = { "audio/x-wavpack", NULL }; +static char const *const wavpackSuffixes[] = { "wv", NULL }; +static char const *const wavpackMimeTypes[] = { "audio/x-wavpack", NULL }; const struct decoder_plugin wavpackPlugin = { .name = "wavpack", -- cgit v1.2.3