Fixes several issues relating to IPv6.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
include $(TOPDIR)/rules.mk
PKG_NAME:=minidlna
-PKG_RELEASE:=1
+PKG_RELEASE:=6
-PKG_SOURCE_URL=git://minidlna.git.sourceforge.net/gitroot/minidlna/minidlna
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2018-04-10
-PKG_SOURCE_VERSION:=799e6cf505ec470b2bf0ae4118143380aa16b837
-PKG_MIRROR_HASH:=67cc817e671de99e5a3f5ed237f89e22470f1de94819bcaba86c0ba821104af5
+PKG_SOURCE_URL:=https://git.code.sf.net/p/minidlna/git
+PKG_SOURCE_DATE:=2019-12-09
+PKG_SOURCE_VERSION:=0763719f2776f91114bc5564919896f28e078c77
+PKG_MIRROR_HASH:=93030a80eff44c0ec13f54daf3b2ba345b70ef8645e0343a34092f37d6f9e8dd
-PKG_LICENSE:=GPL-2.0 BSD-3-Clause
+PKG_MAINTAINER:=
+PKG_LICENSE:=GPL-2.0-or-later BSD-3-Clause
PKG_LICENSE_FILES:=COPYING LICENCE.miniupnpd
-PKG_MAINTAINER:=Knyazkov Dmitry <medavedik@gmail.com>
-
PKG_FIXUP:=autoreconf
-
-PKG_BUILD_PARALLEL:=0
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=util-linux
include $(INCLUDE_DIR)/package.mk
/etc/config/minidlna
endef
-TARGET_CPPFLAGS += \
- -I$(ICONV_PREFIX)/include \
- -I$(INTL_PREFIX)/include \
- -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
-
-TARGET_LDFLAGS += \
- -L$(ICONV_PREFIX)/lib \
- -L$(INTL_PREFIX)/lib \
- -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
-
-MAKE_FLAGS +=\
- CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
- LDFLAGS="$(TARGET_LDFLAGS)" \
- ICONV_LIBS="-liconv $(if $(INTL_FULL),-lintl)" \
-
-CONFIGURE_ARGS +=\
+CONFIGURE_ARGS += \
--with-libiconv-prefix="$(ICONV_PREFIX)" \
--with-libintl-prefix="$(INTL_PREFIX)" \
--with-os-name="OpenWrt Linux" \
--with-os-version="$(LINUX_VERSION)" \
- --with-os-url="http://openwrt.org/" \
+ --with-os-url="https://openwrt.org/" \
--with-db-path="/var/run/minidlna" \
- --with-log-path="/var/log" \
+ --with-log-path="/var/log"
+
+TARGET_CFLAGS += -DHAVE_CLOCK_GETTIME
define Package/minidlna/install
- $(INSTALL_DIR) $(1)/usr/bin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/minidlnad $(1)/usr/bin/minidlna
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/minidlnad $(1)/usr/sbin/minidlnad
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/minidlna.init $(1)/etc/init.d/minidlna
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/minidlna.config $(1)/etc/config/minidlna
+ $(INSTALL_DIR) $(1)/etc/sysctl.d
+ $(INSTALL_CONF) ./files/minidlna.sysctl $(1)/etc/sysctl.d/30-minidlna.conf
endef
$(eval $(call BuildPackage,minidlna))
config minidlna config
- option 'enabled' '0'
+ option enabled '0'
option user 'minidlna'
option port '8200'
option interface 'br-lan'
option friendly_name 'OpenWrt DLNA Server'
option db_dir '/var/run/minidlna'
- option log_dir '/var/log/minidlna'
option inotify '1'
option enable_tivo '0'
option wide_links '0'
option serial '12345678'
option model_number '1'
option root_container '.'
+ option uuid ''
list media_dir '/mnt'
option album_art_names 'Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg'
#!/bin/sh /etc/rc.common
# Copyright (C) 2010 OpenWrt.org
-START=50
+START=81
-SERVICE_USE_PID=1
-SERVICE_PID_FILE=/var/run/minidlna/minidlna.pid
+PROG=/usr/sbin/minidlnad
+USE_PROCD=1
MINIDLNA_CONFIG_FILE="/var/etc/minidlna.conf"
-minidlna_cfg_append() {
- echo "$1" >> "$MINIDLNA_CONFIG_FILE"
-}
-
minidlna_cfg_addbool() {
local cfg="$1"
local key="$2"
config_get_bool val "$cfg" "$key" "$def"
[ "$val" -gt 0 ] && val="yes" || val="no"
- minidlna_cfg_append "$key=$val"
+ echo "$key=$val"
}
minidlna_cfg_addstr() {
local val
config_get val "$cfg" "$key" "$def"
- [ -n "$val" ] && minidlna_cfg_append "$key=$val"
+ [ -n "$val" ] && echo "$key=$val"
}
minidlna_cfg_add_media_dir() {
local val=$1
- minidlna_cfg_append "media_dir=$val"
+ echo "media_dir=$val"
}
minidlna_create_config() {
config_get port "$cfg" port
config_get interface "$cfg" interface
- [ -z "$interface" -o -t "$port" ] && return 1
+ { [ -z "$interface" ] || [ -t "$port" ]; } && return 1
mkdir -p /var/etc
- echo "# this file is generated automatically, don't edit" > "$MINIDLNA_CONFIG_FILE"
+ echo "# this file is generated automatically, don't edit"
- minidlna_cfg_append "port=$port"
- minidlna_cfg_append "network_interface=$interface"
+ echo "port=$port"
+ echo "network_interface=$interface"
minidlna_cfg_addstr "$cfg" friendly_name
minidlna_cfg_addstr "$cfg" user
minidlna_cfg_addstr "$cfg" db_dir
- minidlna_cfg_addstr "$cfg" log_dir
minidlna_cfg_addstr "$cfg" log_level 'error'
minidlna_cfg_addbool "$cfg" inotify '1'
minidlna_cfg_addbool "$cfg" enable_tivo '0'
minidlna_cfg_addstr "$cfg" model_number '1'
minidlna_cfg_addstr "$cfg" minissdpsocket
minidlna_cfg_addstr "$cfg" root_container '.'
+ minidlna_cfg_addstr "$cfg" uuid '019f9a56-ff60-44c0-9edc-eae88d09fa05'
config_list_foreach "$cfg" "media_dir" minidlna_cfg_add_media_dir
return 0
-}
+} > "$MINIDLNA_CONFIG_FILE"
-start() {
+start_service() {
local enabled
local db_dir
- local log_dir
local user
+ local val
config_load 'minidlna'
config_get_bool enabled config 'enabled' '0'
[ "$enabled" -gt 0 ] || return 1
- minidlna_create_config config || return 1
-
- config_get db_dir config 'db_dir' '/var/run/minidlna'
- config_get log_dir config 'log_dir' '/var/log/minidlna'
- config_get user config 'user' 'root'
-
- mkdir -m 0755 -p "$db_dir" "$log_dir"
- chown -R "$user" "$db_dir" "$log_dir"
+ config_get val "config" uuid
+ [ "$val" = '' ] && uci set minidlna.config.uuid="$(cat /proc/sys/kernel/random/uuid)" && uci commit
- service_start /usr/bin/minidlna -f "$MINIDLNA_CONFIG_FILE"
-}
+ minidlna_create_config config || return 1
-stop() {
- service_stop /usr/bin/minidlna
+ config_get db_dir config 'db_dir' '/var/run/minidlna'
+ config_get user config 'user' 'minidlna'
+
+ [ -d "$db_dir" ] || {
+ mkdir -m 755 -p "$db_dir"
+ chown -R "$user":"$user" "$db_dir"
+ }
+
+ procd_open_instance
+ procd_set_param command "$PROG"
+ procd_append_param command -S -f "$MINIDLNA_CONFIG_FILE"
+ procd_set_param stdout 1
+ procd_set_param stderr 1
+ procd_set_param respawn
+ procd_close_instance
}
--- /dev/null
+# this is the desired value for minidlna
+fs.inotify.max_user_watches=65536
--- /dev/null
+From e4a045e92b864dc148ca46be94668c5b67132405 Mon Sep 17 00:00:00 2001
+From: VergLsm <vision.lsm.2012@gmail.com>
+Date: Fri, 31 Jan 2020 10:01:12 +0000
+Subject: [PATCH] Added support RMVB.
+
+---
+ metadata.c | 4 ++++
+ upnpglobalvars.h | 3 ++-
+ utils.c | 3 +++
+ 3 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/metadata.c b/metadata.c
+index 9cd86dc..2d13480 100644
+--- a/metadata.c
++++ b/metadata.c
+@@ -862,6 +862,10 @@ GetVideoMetadata(const char *path, const char *name)
+ xasprintf(&m.mime, "video/x-matroska");
+ else if( strcmp(ctx->iformat->name, "flv") == 0 )
+ xasprintf(&m.mime, "video/x-flv");
++ else if( strcmp(ctx->iformat->name, "rm") == 0 )
++ xasprintf(&m.mime, "video/x-pn-realvideo");
++ else if( strcmp(ctx->iformat->name, "rmvb") == 0 )
++ xasprintf(&m.mime, "video/x-pn-realvideo");
+ if( m.mime )
+ goto video_no_dlna;
+
+diff --git a/upnpglobalvars.h b/upnpglobalvars.h
+index 1a2fb5e..2cbe24c 100644
+--- a/upnpglobalvars.h
++++ b/upnpglobalvars.h
+@@ -172,7 +172,8 @@
+ "http-get:*:audio/x-wav:*," \
+ "http-get:*:audio/x-flac:*," \
+ "http-get:*:audio/x-dsd:*," \
+- "http-get:*:application/ogg:*"
++ "http-get:*:application/ogg:*,"\
++ "http-get:*:video/x-pn-realvideo:*"
+
+ #define DLNA_FLAG_DLNA_V1_5 0x00100000
+ #define DLNA_FLAG_HTTP_STALLING 0x00200000
+diff --git a/utils.c b/utils.c
+index dc936f9..006f611 100644
+--- a/utils.c
++++ b/utils.c
+@@ -377,6 +377,8 @@ mime_to_ext(const char * mime)
+ return "3gp";
+ else if( strncmp(mime+6, "x-tivo-mpeg", 11) == 0 )
+ return "TiVo";
++ else if( strcmp(mime+6, "x-pn-realvideo") == 0 )
++ return "rm";
+ break;
+ case 'i':
+ if( strcmp(mime+6, "jpeg") == 0 )
+@@ -401,6 +403,7 @@ is_video(const char * file)
+ ends_with(file, ".m2t") || ends_with(file, ".mkv") ||
+ ends_with(file, ".vob") || ends_with(file, ".ts") ||
+ ends_with(file, ".flv") || ends_with(file, ".xvid") ||
++ ends_with(file, ".rm") || ends_with(file, ".rmvb") ||
+ #ifdef TIVO_SUPPORT
+ ends_with(file, ".TiVo") ||
+ #endif
+--
+2.20.1
+
--- /dev/null
+From eb473817d73b8740f27955f93950029fdfc9d73e Mon Sep 17 00:00:00 2001
+From: Daniel Kamil Kozar <dkk089@gmail.com>
+Date: Sat, 15 Dec 2018 00:55:20 +0100
+Subject: [PATCH] LG webOS 3.5 devices require audio/flac in order to detect
+ FLAC
+
+Imported from https://sourceforge.net/p/minidlna/patches/176/
+---
+ clients.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/clients.c b/clients.c
+index 42f0d1c..d324eab 100644
+--- a/clients.c
++++ b/clients.c
+@@ -164,7 +164,7 @@ struct client_type_s client_types[] =
+
+ /* USER-AGENT: Linux/2.6.35 UPnP/1.0 DLNADOC/1.50 INTEL_NMPR/2.0 LGE_DLNA_SDK/1.6.0 */
+ { ELGNetCastDevice,
+- FLAG_DLNA | FLAG_CAPTION_RES,
++ FLAG_DLNA | FLAG_CAPTION_RES | FLAG_MIME_FLAC_FLAC,
+ "LG",
+ "LGE_DLNA_SDK/1.6.0",
+ EUserAgent
--- /dev/null
+From e0065b8343bc963a89556449e00f1d20086cc1f1 Mon Sep 17 00:00:00 2001
+From: Daniel Kamil Kozar <dkk089@gmail.com>
+Date: Sat, 15 Dec 2018 16:26:37 +0100
+Subject: [PATCH] Wrap container definitions into a structure
+
+---
+ containers.c | 25 +++++++++++++++++++++++++
+ containers.h | 8 ++++++++
+ scanner.c | 33 ++++++---------------------------
+ 3 files changed, 39 insertions(+), 27 deletions(-)
+
+diff --git a/containers.c b/containers.c
+index f5cece1..19a0bb1 100644
+--- a/containers.c
++++ b/containers.c
+@@ -23,6 +23,31 @@
+ #include "containers.h"
+ #include "log.h"
+
++const struct container_s containers[] = {
++ { "0","-1", "root" },
++ { MUSIC_ID, "0", "Music" },
++ { MUSIC_ALL_ID, MUSIC_ID, "All Music" },
++ { MUSIC_GENRE_ID, MUSIC_ID, "Genre" },
++ { MUSIC_ARTIST_ID, MUSIC_ID, "Artist" },
++ { MUSIC_ALBUM_ID, MUSIC_ID, "Album" },
++ { MUSIC_DIR_ID, MUSIC_ID, "Folders" },
++ { MUSIC_PLIST_ID, MUSIC_ID, "Playlists" },
++
++ { VIDEO_ID, "0", "Video" },
++ { VIDEO_ALL_ID, VIDEO_ID, "All Video" },
++ { VIDEO_DIR_ID, VIDEO_ID, "Folders" },
++
++ { IMAGE_ID, "0", "Pictures" },
++ { IMAGE_ALL_ID, IMAGE_ID, "All Pictures" },
++ { IMAGE_DATE_ID, IMAGE_ID, "Date Taken" },
++ { IMAGE_CAMERA_ID, IMAGE_ID, "Camera" },
++ { IMAGE_DIR_ID, IMAGE_ID, "Folders" },
++
++ { BROWSEDIR_ID, "0", "Browse Folders" },
++
++ { 0, 0, 0 }
++};
++
+ #define NINETY_DAYS "7776000"
+
+ const char *music_id = MUSIC_ID;
+diff --git a/containers.h b/containers.h
+index aef77c5..1fcf7cd 100644
+--- a/containers.h
++++ b/containers.h
+@@ -16,6 +16,14 @@
+ * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>.
+ */
+
++struct container_s {
++ const char *object_id;
++ const char *parent_id;
++ const char *name;
++};
++
++extern const struct container_s containers[];
++
+ struct magic_container_s {
+ const char *name;
+ const char *objectid_match;
+diff --git a/scanner.c b/scanner.c
+index a730567..eb26c9e 100644
+--- a/scanner.c
++++ b/scanner.c
+@@ -529,30 +529,7 @@ insert_file(const char *name, const char *path, const char *parentID, int object
+ int
+ CreateDatabase(void)
+ {
+- int ret, i;
+- const char *containers[] = { "0","-1", "root",
+- MUSIC_ID, "0", _("Music"),
+- MUSIC_ALL_ID, MUSIC_ID, _("All Music"),
+- MUSIC_GENRE_ID, MUSIC_ID, _("Genre"),
+- MUSIC_ARTIST_ID, MUSIC_ID, _("Artist"),
+- MUSIC_ALBUM_ID, MUSIC_ID, _("Album"),
+- MUSIC_DIR_ID, MUSIC_ID, _("Folders"),
+- MUSIC_PLIST_ID, MUSIC_ID, _("Playlists"),
+-
+- VIDEO_ID, "0", _("Video"),
+- VIDEO_ALL_ID, VIDEO_ID, _("All Video"),
+- VIDEO_DIR_ID, VIDEO_ID, _("Folders"),
+-
+- IMAGE_ID, "0", _("Pictures"),
+- IMAGE_ALL_ID, IMAGE_ID, _("All Pictures"),
+- IMAGE_DATE_ID, IMAGE_ID, _("Date Taken"),
+- IMAGE_CAMERA_ID, IMAGE_ID, _("Camera"),
+- IMAGE_DIR_ID, IMAGE_ID, _("Folders"),
+-
+- BROWSEDIR_ID, "0", _("Browse Folders"),
+- 0 };
+-
+- ret = sql_exec(db, create_objectTable_sqlite);
++ int ret = sql_exec(db, create_objectTable_sqlite);
+ if( ret != SQLITE_OK )
+ goto sql_failed;
+ ret = sql_exec(db, create_detailTable_sqlite);
+@@ -576,16 +553,18 @@ CreateDatabase(void)
+ ret = sql_exec(db, "INSERT into SETTINGS values ('UPDATE_ID', '0')");
+ if( ret != SQLITE_OK )
+ goto sql_failed;
+- for( i=0; containers[i]; i=i+3 )
++ for( int i=0; containers[i].name; ++i )
+ {
++ const struct container_s *c = &containers[i];
++ const char *name = _(c->name);
+ ret = sql_exec(db, "INSERT into OBJECTS (OBJECT_ID, PARENT_ID, DETAIL_ID, CLASS, NAME)"
+ " values "
+ "('%s', '%s', %lld, 'container.storageFolder', '%q')",
+- containers[i], containers[i+1], GetFolderMetadata(containers[i+2], NULL, NULL, NULL, 0), containers[i+2]);
++ c->object_id, c->parent_id, GetFolderMetadata(name, NULL, NULL, NULL, 0), name);
+ if( ret != SQLITE_OK )
+ goto sql_failed;
+ }
+- for( i=0; magic_containers[i].objectid_match; i++ )
++ for( int i=0; magic_containers[i].objectid_match; i++ )
+ {
+ struct magic_container_s *magic = &magic_containers[i];
+ if (!magic->name)
--- /dev/null
+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 @@
+
+ #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
+@@ -800,7 +800,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;
+
+@@ -1297,7 +1297,7 @@ BrowseContentDirectory(struct upnphttp *
+ "<Result>"
+ "<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;
+@@ -1819,7 +1819,7 @@ SearchContentDirectory(struct upnphttp *
+ "<Result>"
+ "<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;
--- /dev/null
+From 972fb2bbfdb7118551da45c5828c9e74be581fc4 Mon Sep 17 00:00:00 2001
+From: Daniel Kamil Kozar <dkk089@gmail.com>
+Date: Sat, 15 Dec 2018 21:55:52 +0100
+Subject: [PATCH] What about David Bowie's "Heroes"?
+
+---
+ utils.c | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/utils.c b/utils.c
+index dc936f9..dfa2b65 100644
+--- a/utils.c
++++ b/utils.c
+@@ -87,13 +87,6 @@ trim(char *str)
+ len--;
+ }
+
+- if (str[0] == '"' && str[len-1] == '"')
+- {
+- str[0] = '\0';
+- str[len-1] = '\0';
+- str++;
+- }
+-
+ return str;
+ }
+
--- /dev/null
+From be9de8b2e0864b46498496af9ffdc31c0e7b764a Mon Sep 17 00:00:00 2001
+From: Daniel Kamil Kozar <dkk089@gmail.com>
+Date: Sun, 16 Dec 2018 14:21:58 +0100
+Subject: [PATCH] Reduce duplication in sql.c
+
+---
+ sql.c | 166 ++++++++++++++++++++--------------------------------------
+ 1 file changed, 58 insertions(+), 108 deletions(-)
+
+--- a/sql.c
++++ b/sql.c
+@@ -65,122 +65,72 @@ sql_get_table(sqlite3 *db, const char *s
+ return ret;
+ }
+
++#define sql_get_field(type, column_get_fn) \
++ va_list ap;\
++ int counter, result;\
++ char *sql;\
++ type ret;\
++ sqlite3_stmt *stmt;\
++ \
++ va_start(ap, fmt);\
++ sql = sqlite3_vmprintf(fmt, ap);\
++ va_end(ap);\
++\
++ /*DPRINTF(E_DEBUG, L_DB_SQL, "sql: %s\n", sql); */ \
++\
++ switch (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL))\
++ {\
++ case SQLITE_OK:\
++ break;\
++ default:\
++ DPRINTF(E_ERROR, L_DB_SQL, "prepare failed: %s\n%s\n", sqlite3_errmsg(db), sql);\
++ sqlite3_free(sql);\
++ return -1;\
++ }\
++\
++ for (counter = 0;\
++ ((result = sqlite3_step(stmt)) == SQLITE_BUSY || result == SQLITE_LOCKED) && counter < 2;\
++ counter++) {\
++ /* While SQLITE_BUSY has a built in timeout,\
++ * SQLITE_LOCKED does not, so sleep */\
++ if (result == SQLITE_LOCKED)\
++ sleep(1);\
++ }\
++\
++ switch (result)\
++ {\
++ case SQLITE_DONE:\
++ /* no rows returned */\
++ ret = 0;\
++ break;\
++ case SQLITE_ROW:\
++ if (sqlite3_column_type(stmt, 0) == SQLITE_NULL)\
++ {\
++ ret = 0;\
++ break;\
++ }\
++ ret = column_get_fn(stmt, 0);\
++ break;\
++ default:\
++ DPRINTF(E_WARN, L_DB_SQL, "%s: step failed: %s\n%s\n", __func__, sqlite3_errmsg(db), sql);\
++ ret = -1;\
++ break;\
++ }\
++ sqlite3_free(sql);\
++ sqlite3_finalize(stmt);\
++\
++ return ret;
++
+ int
+ sql_get_int_field(sqlite3 *db, const char *fmt, ...)
+ {
+- va_list ap;
+- int counter, result;
+- char *sql;
+- int ret;
+- sqlite3_stmt *stmt;
+-
+- va_start(ap, fmt);
+- sql = sqlite3_vmprintf(fmt, ap);
+- va_end(ap);
+-
+- //DPRINTF(E_DEBUG, L_DB_SQL, "sql: %s\n", sql);
+-
+- switch (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL))
+- {
+- case SQLITE_OK:
+- break;
+- default:
+- DPRINTF(E_ERROR, L_DB_SQL, "prepare failed: %s\n%s\n", sqlite3_errmsg(db), sql);
+- sqlite3_free(sql);
+- return -1;
+- }
+-
+- for (counter = 0;
+- ((result = sqlite3_step(stmt)) == SQLITE_BUSY || result == SQLITE_LOCKED) && counter < 2;
+- counter++) {
+- /* While SQLITE_BUSY has a built in timeout,
+- * SQLITE_LOCKED does not, so sleep */
+- if (result == SQLITE_LOCKED)
+- sleep(1);
+- }
+-
+- switch (result)
+- {
+- case SQLITE_DONE:
+- /* no rows returned */
+- ret = 0;
+- break;
+- case SQLITE_ROW:
+- if (sqlite3_column_type(stmt, 0) == SQLITE_NULL)
+- {
+- ret = 0;
+- break;
+- }
+- ret = sqlite3_column_int(stmt, 0);
+- break;
+- default:
+- DPRINTF(E_WARN, L_DB_SQL, "%s: step failed: %s\n%s\n", __func__, sqlite3_errmsg(db), sql);
+- ret = -1;
+- break;
+- }
+- sqlite3_free(sql);
+- sqlite3_finalize(stmt);
+-
+- return ret;
++ sql_get_field(int, sqlite3_column_int)
+ }
+
+ int64_t
+ sql_get_int64_field(sqlite3 *db, const char *fmt, ...)
+ {
+- va_list ap;
+- int counter, result;
+- char *sql;
+- int64_t ret;
+- sqlite3_stmt *stmt;
+-
+- va_start(ap, fmt);
+- sql = sqlite3_vmprintf(fmt, ap);
+- va_end(ap);
+-
+- //DPRINTF(E_DEBUG, L_DB_SQL, "sql: %s\n", sql);
+-
+- switch (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL))
+- {
+- case SQLITE_OK:
+- break;
+- default:
+- DPRINTF(E_ERROR, L_DB_SQL, "prepare failed: %s\n%s\n", sqlite3_errmsg(db), sql);
+- sqlite3_free(sql);
+- return -1;
+- }
+-
+- for (counter = 0;
+- ((result = sqlite3_step(stmt)) == SQLITE_BUSY || result == SQLITE_LOCKED) && counter < 2;
+- counter++) {
+- /* While SQLITE_BUSY has a built in timeout,
+- * SQLITE_LOCKED does not, so sleep */
+- if (result == SQLITE_LOCKED)
+- sleep(1);
+- }
+-
+- switch (result)
+- {
+- case SQLITE_DONE:
+- /* no rows returned */
+- ret = 0;
+- break;
+- case SQLITE_ROW:
+- if (sqlite3_column_type(stmt, 0) == SQLITE_NULL)
+- {
+- ret = 0;
+- break;
+- }
+- ret = sqlite3_column_int64(stmt, 0);
+- break;
+- default:
+- DPRINTF(E_WARN, L_DB_SQL, "%s: step failed: %s\n%s\n", __func__, sqlite3_errmsg(db), sql);
+- ret = -1;
+- break;
+- }
+- sqlite3_free(sql);
+- sqlite3_finalize(stmt);
+-
+- return ret;
++ sql_get_field(int64_t, sqlite3_column_int64)
+ }
+
+ char *
--- /dev/null
+From ce34745bb19a649c8570ef0a3da9ffd5e941548e Mon Sep 17 00:00:00 2001
+From: Daniel Kamil Kozar <dkk089@gmail.com>
+Date: Sun, 30 Dec 2018 22:49:50 +0100
+Subject: [PATCH] No return in a function returning non-void
+
+---
+ upnpdescgen.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/upnpdescgen.c b/upnpdescgen.c
+index 85ce185..78d5754 100644
+--- a/upnpdescgen.c
++++ b/upnpdescgen.c
+@@ -525,6 +525,7 @@ genXML(char *str, int *len, int *tmplen, const struct XMLElt *p)
+ pile[top].eltname = eltname;
+ }
+ }
++ return str;
+ }
+
+ /* genRootDesc() :