diff --git a/src/db.c b/src/db.c index 412095dc..014b94b6 100644 --- a/src/db.c +++ b/src/db.c @@ -60,7 +60,7 @@ struct col_type_map { * - the order of the columns in the files table * - the type and name of the fields in struct media_file_info */ -static struct col_type_map mfi_cols_map[] = +static const struct col_type_map mfi_cols_map[] = { { mfi_offsetof(id), DB_TYPE_INT }, { mfi_offsetof(path), DB_TYPE_STRING }, @@ -117,7 +117,7 @@ static struct col_type_map mfi_cols_map[] = * - the order of the columns in the playlists table * - the type and name of the fields in struct playlist_info */ -static struct col_type_map pli_cols_map[] = +static const struct col_type_map pli_cols_map[] = { { pli_offsetof(id), DB_TYPE_INT }, { pli_offsetof(title), DB_TYPE_STRING }, @@ -136,7 +136,7 @@ static struct col_type_map pli_cols_map[] = * - the order of the columns in the files table * - the name of the fields in struct db_media_file_info */ -static ssize_t dbmfi_cols_map[] = +static const ssize_t dbmfi_cols_map[] = { dbmfi_offsetof(id), dbmfi_offsetof(path), @@ -193,7 +193,7 @@ static ssize_t dbmfi_cols_map[] = * - the order of the columns in the playlists table * - the name of the fields in struct playlist_info */ -static ssize_t dbpli_cols_map[] = +static const ssize_t dbpli_cols_map[] = { dbpli_offsetof(id), dbpli_offsetof(title), @@ -212,7 +212,7 @@ static ssize_t dbpli_cols_map[] = * - the order of fields in the Q_GROUPS query * - the name of the fields in struct group_info */ -static ssize_t dbgri_cols_map[] = +static const ssize_t dbgri_cols_map[] = { dbgri_offsetof(itemcount), dbgri_offsetof(id), @@ -225,7 +225,7 @@ static ssize_t dbgri_cols_map[] = * - the order of the columns in the inotify table * - the name and type of the fields in struct watch_info */ -static struct col_type_map wi_cols_map[] = +static const struct col_type_map wi_cols_map[] = { { wi_offsetof(wd), DB_TYPE_INT }, { wi_offsetof(cookie), DB_TYPE_INT }, @@ -3540,7 +3540,7 @@ struct db_init_query { char *desc; }; -static struct db_init_query db_init_queries[] = +static const struct db_init_query db_init_queries[] = { { T_ADMIN, "create table admin" }, { T_FILES, "create table files" }, @@ -3591,7 +3591,7 @@ db_create_tables(void) } static int -db_generic_upgrade(struct db_init_query *queries, int nqueries) +db_generic_upgrade(const struct db_init_query *queries, int nqueries) { char *errmsg; int i; @@ -3631,7 +3631,7 @@ db_generic_upgrade(struct db_init_query *queries, int nqueries) #define U_V2_SCVER \ "UPDATE admin SET value = '2' WHERE key = 'schema_version';" -static struct db_init_query db_upgrade_v2_queries[] = +static const struct db_init_query db_upgrade_v2_queries[] = { { U_V2_FILES, "upgrade table files" }, { U_V2_RESCAN, "force library rescan" }, @@ -3646,7 +3646,7 @@ static struct db_init_query db_upgrade_v2_queries[] = #define U_V3_SCVER \ "UPDATE admin SET value = '3' WHERE key = 'schema_version';" -static struct db_init_query db_upgrade_v3_queries[] = +static const struct db_init_query db_upgrade_v3_queries[] = { { U_V3_FILES, "upgrade table files" }, { U_V3_SCVER, "set schema_version to 3" }, @@ -3675,7 +3675,7 @@ static struct db_init_query db_upgrade_v3_queries[] = #define U_V4_SCVER \ "UPDATE admin SET value = '4' WHERE key = 'schema_version';" -static struct db_init_query db_upgrade_v4_queries[] = +static const struct db_init_query db_upgrade_v4_queries[] = { { U_V4_PLAYLISTS, "upgrade table playlists" }, { U_V4_PL1, "update playlist 1" }, @@ -3696,7 +3696,7 @@ static struct db_init_query db_upgrade_v4_queries[] = #define U_V5_SCVER \ "UPDATE admin SET value = '5' WHERE key = 'schema_version';" -static struct db_init_query db_upgrade_v5_queries[] = +static const struct db_init_query db_upgrade_v5_queries[] = { { U_V5_FIXPL, "fix 'Movies' smart playlist" }, { U_V5_RESCAN, "force library rescan" }, @@ -3718,7 +3718,7 @@ static struct db_init_query db_upgrade_v5_queries[] = #define U_V6_SCVER \ "UPDATE admin SET value = '6' WHERE key = 'schema_version';" -static struct db_init_query db_upgrade_v6_queries[] = +static const struct db_init_query db_upgrade_v6_queries[] = { { U_V6_PAIRINGS, "create pairings table" }, { U_V6_PAIRINGGUID, "create pairing guid index" }, @@ -3736,7 +3736,7 @@ static struct db_init_query db_upgrade_v6_queries[] = #define U_V7_SCVER \ "UPDATE admin SET value = '7' WHERE key = 'schema_version';" -static struct db_init_query db_upgrade_v7_queries[] = +static const struct db_init_query db_upgrade_v7_queries[] = { { U_V7_FILES, "upgrade table files" }, { U_V7_RESCAN, "force library rescan" }, @@ -3769,7 +3769,7 @@ static struct db_init_query db_upgrade_v7_queries[] = #define U_V8_SCVER \ "UPDATE admin SET value = '8' WHERE key = 'schema_version';" -static struct db_init_query db_upgrade_v8_queries[] = +static const struct db_init_query db_upgrade_v8_queries[] = { { U_V8_GROUPS, "create groups table" }, { U_V8_TRG1, "create trigger update_groups_new_file" }, @@ -3792,7 +3792,7 @@ static struct db_init_query db_upgrade_v8_queries[] = #define U_V9_SCVER \ "UPDATE admin SET value = '9' WHERE key = 'schema_version';" -static struct db_init_query db_upgrade_v9_queries[] = +static const struct db_init_query db_upgrade_v9_queries[] = { { U_V9_INOTIFY1, "drop table inotify" }, { U_V9_INOTIFY2, "create new table inotify" }, diff --git a/src/filescanner_ffmpeg.c b/src/filescanner_ffmpeg.c index 2c7a54a6..8789e257 100644 --- a/src/filescanner_ffmpeg.c +++ b/src/filescanner_ffmpeg.c @@ -56,7 +56,7 @@ struct metadata_map { }; /* Lookup is case-insensitive, first occurrence takes precedence */ -static struct metadata_map md_map_generic[] = +static const struct metadata_map md_map_generic[] = { { "title", 0, mfi_offsetof(title) }, { "artist", 0, mfi_offsetof(artist) }, @@ -82,7 +82,7 @@ static struct metadata_map md_map_generic[] = { NULL, 0, 0 } }; -static struct metadata_map md_map_tv[] = +static const struct metadata_map md_map_tv[] = { { "stik", 1, mfi_offsetof(media_kind) }, { "show", 0, mfi_offsetof(tv_series_name) }, @@ -103,7 +103,7 @@ static struct metadata_map md_map_tv[] = * the changes listed above will be generally available. The more entries in the * map, the slower the filescanner gets. */ -static struct metadata_map md_map_id3[] = +static const struct metadata_map md_map_id3[] = { { "TT2", 0, mfi_offsetof(title) }, /* ID3v2.2 */ { "TIT2", 0, mfi_offsetof(title) }, /* ID3v2.3 */ @@ -130,7 +130,7 @@ static struct metadata_map md_map_id3[] = static int -extract_metadata_core(struct media_file_info *mfi, AVMetadata *md, struct metadata_map *md_map) +extract_metadata_core(struct media_file_info *mfi, AVMetadata *md, const struct metadata_map *md_map) { AVMetadataTag *mdt; char **strval; @@ -196,7 +196,7 @@ extract_metadata_core(struct media_file_info *mfi, AVMetadata *md, struct metada } static int -extract_metadata(struct media_file_info *mfi, AVMetadata *md, struct metadata_map *extra_md_map) +extract_metadata(struct media_file_info *mfi, AVMetadata *md, const struct metadata_map *extra_md_map) { int mdcount; int extra; @@ -221,7 +221,7 @@ int scan_metadata_ffmpeg(char *file, struct media_file_info *mfi) { AVFormatContext *ctx; - struct metadata_map *extra_md_map; + const struct metadata_map *extra_md_map; enum CodecID codec_id; enum CodecID video_codec_id; enum CodecID audio_codec_id; diff --git a/src/httpd.c b/src/httpd.c index 32b2fca3..3652879c 100644 --- a/src/httpd.c +++ b/src/httpd.c @@ -99,7 +99,7 @@ struct stream_ctx { }; -static struct content_type_map ext2ctype[] = +static const struct content_type_map ext2ctype[] = { { ".html", "text/html; charset=utf-8" }, { ".xml", "text/xml; charset=utf-8" }, diff --git a/src/httpd_rsp.c b/src/httpd_rsp.c index c3f8b15e..a9a1cbcf 100644 --- a/src/httpd_rsp.c +++ b/src/httpd_rsp.c @@ -68,7 +68,7 @@ struct uri_map { void (*handler)(struct evhttp_request *req, char **uri, struct evkeyvalq *query); }; -static struct field_map pl_fields[] = +static const struct field_map pl_fields[] = { { "id", dbpli_offsetof(id), F_ALWAYS }, { "title", dbpli_offsetof(title), F_FULL | F_BROWSE | F_DETAILED }, @@ -81,7 +81,7 @@ static struct field_map pl_fields[] = { NULL, 0, 0 } }; -static struct field_map rsp_fields[] = +static const struct field_map rsp_fields[] = { { "id", dbmfi_offsetof(id), F_ALWAYS }, { "path", dbmfi_offsetof(path), F_DETAILED },