From d297624e533d6d4274c750e3769749c3d7f121c8 Mon Sep 17 00:00:00 2001
From: Daniel Kamil Kozar <dkk089@gmail.com>
Date: Sat, 15 Dec 2018 16:34:30 +0100
Subject: [PATCH] Mark all instances of magic_container_s as const

---
 containers.c | 38 +++++++++++++++++++-------------------
 containers.h |  6 +++---
 scanner.c    |  2 +-
 upnpsoap.c   |  6 +++---
 4 files changed, 26 insertions(+), 26 deletions(-)

--- a/containers.c
+++ b/containers.c
@@ -50,23 +50,23 @@ const struct container_s containers[] =
 
 #define NINETY_DAYS "7776000"
 
-const char *music_id = MUSIC_ID;
-const char *music_all_id = MUSIC_ALL_ID;
-const char *music_genre_id = MUSIC_GENRE_ID;
-const char *music_artist_id = MUSIC_ARTIST_ID;
-const char *music_album_id = MUSIC_ALBUM_ID;
-const char *music_plist_id = MUSIC_PLIST_ID;
-const char *music_dir_id = MUSIC_DIR_ID;
-const char *video_id = VIDEO_ID;
-const char *video_all_id = VIDEO_ALL_ID;
-const char *video_dir_id = VIDEO_DIR_ID;
-const char *image_id = IMAGE_ID;
-const char *image_all_id = IMAGE_ALL_ID;
-const char *image_date_id = IMAGE_DATE_ID;
-const char *image_camera_id = IMAGE_CAMERA_ID;
-const char *image_dir_id = IMAGE_DIR_ID;
+static const char *music_id = MUSIC_ID;
+static const char *music_all_id = MUSIC_ALL_ID;
+static const char *music_genre_id = MUSIC_GENRE_ID;
+static const char *music_artist_id = MUSIC_ARTIST_ID;
+static const char *music_album_id = MUSIC_ALBUM_ID;
+static const char *music_plist_id = MUSIC_PLIST_ID;
+static const char *music_dir_id = MUSIC_DIR_ID;
+static const char *video_id = VIDEO_ID;
+static const char *video_all_id = VIDEO_ALL_ID;
+static const char *video_dir_id = VIDEO_DIR_ID;
+static const char *image_id = IMAGE_ID;
+static const char *image_all_id = IMAGE_ALL_ID;
+static const char *image_date_id = IMAGE_DATE_ID;
+static const char *image_camera_id = IMAGE_CAMERA_ID;
+static const char *image_dir_id = IMAGE_DIR_ID;
 
-struct magic_container_s magic_containers[] =
+const struct magic_container_s magic_containers[] =
 {
 	/* Alternate root container */
 	{ NULL,
@@ -149,7 +149,7 @@ struct magic_container_s magic_container
 	{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0 }
 };
 
-struct magic_container_s *
+const struct magic_container_s *
 in_magic_container(const char *id, int flags, const char **real_id)
 {
 	size_t len;
@@ -179,7 +179,7 @@ in_magic_container(const char *id, int f
 	return NULL;
 }
 
-struct magic_container_s *
+const struct magic_container_s *
 check_magic_container(const char *id, int flags)
 {
 	int i;
--- a/containers.h
+++ b/containers.h
@@ -38,7 +38,7 @@ struct magic_container_s {
 	int required_flags;
 };
 
-extern struct magic_container_s magic_containers[];
+extern const struct magic_container_s magic_containers[];
 
-struct magic_container_s *in_magic_container(const char *id, int flags, const char **real_id);
-struct magic_container_s *check_magic_container(const char *id, int flags);
+const struct magic_container_s *in_magic_container(const char *id, int flags, const char **real_id);
+const struct magic_container_s *check_magic_container(const char *id, int flags);
--- a/scanner.c
+++ b/scanner.c
@@ -566,7 +566,7 @@ CreateDatabase(void)
 	}
 	for( int i=0; magic_containers[i].objectid_match; i++ )
 	{
-		struct magic_container_s *magic = &magic_containers[i];
+		const struct magic_container_s *magic = &magic_containers[i];
 		if (!magic->name)
 			continue;
 		if( sql_get_int_field(db, "SELECT 1 from OBJECTS where OBJECT_ID = '%s'", magic->objectid_match) == 0 )
--- a/upnpsoap.c
+++ b/upnpsoap.c
@@ -804,7 +804,7 @@ add_res(char *size, char *duration, char
 }
 
 static int
-get_child_count(const char *object, struct magic_container_s *magic)
+get_child_count(const char *object, const struct magic_container_s *magic)
 {
 	int ret;
 
@@ -1301,7 +1301,7 @@ BrowseContentDirectory(struct upnphttp *
 			"<Result>"
 			"&lt;DIDL-Lite"
 			CONTENT_DIRECTORY_SCHEMAS;
-	struct magic_container_s *magic;
+	const struct magic_container_s *magic;
 	char *zErrMsg = NULL;
 	char *sql, *ptr;
 	struct Response args;
@@ -1823,7 +1823,7 @@ SearchContentDirectory(struct upnphttp *
 			"<Result>"
 			"&lt;DIDL-Lite"
 			CONTENT_DIRECTORY_SCHEMAS;
-	struct magic_container_s *magic;
+	const struct magic_container_s *magic;
 	char *zErrMsg = NULL;
 	char *sql, *ptr;
 	struct Response args;
