From f47a17e1866f3a21ab643569504cd5494157d85d Mon Sep 17 00:00:00 2001 From: chme Date: Fri, 2 Mar 2018 17:41:49 +0100 Subject: [PATCH 1/2] [db] Remove unused function "db_queue_get_pos_byfileid" --- src/db.c | 24 ------------------------ src/db.h | 3 --- 2 files changed, 27 deletions(-) diff --git a/src/db.c b/src/db.c index 6ba71fa3..2c34b721 100644 --- a/src/db.c +++ b/src/db.c @@ -4624,30 +4624,6 @@ db_queue_get_pos(uint32_t item_id, char shuffle) #undef Q_TMPL_SHUFFLE } -int -db_queue_get_pos_byfileid(uint32_t file_id, char shuffle) -{ -#define Q_TMPL "SELECT pos FROM queue WHERE file_id = %d LIMIT 1;" -#define Q_TMPL_SHUFFLE "SELECT shuffle_pos FROM queue WHERE file_id = %d LIMIT 1;" - - char *query; - int pos; - - if (shuffle) - query = sqlite3_mprintf(Q_TMPL_SHUFFLE, file_id); - else - query = sqlite3_mprintf(Q_TMPL, file_id); - - pos = db_get_one_int(query); - - sqlite3_free(query); - - return pos; - -#undef Q_TMPL -#undef Q_TMPL_SHUFFLE -} - static int queue_fetch_byitemid(uint32_t item_id, struct db_queue_item *queue_item, int with_metadata) { diff --git a/src/db.h b/src/db.h index 140474ca..776bd23a 100644 --- a/src/db.h +++ b/src/db.h @@ -815,9 +815,6 @@ db_queue_get_count(); int db_queue_get_pos(uint32_t item_id, char shuffle); -int -db_queue_get_pos_byfileid(uint32_t file_id, char shuffle); - /* Inotify */ int db_watch_clear(void); From 2b5fa56bf9c4e98ef843ef4c5192368151eedfe8 Mon Sep 17 00:00:00 2001 From: chme Date: Fri, 2 Mar 2018 17:49:53 +0100 Subject: [PATCH 2/2] [dacp] Add missing call to "db_queue_enum_end" in error case --- src/httpd_dacp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/httpd_dacp.c b/src/httpd_dacp.c index 8680f32d..ef2dbef9 100644 --- a/src/httpd_dacp.c +++ b/src/httpd_dacp.c @@ -1703,7 +1703,10 @@ dacp_reply_playqueuecontents(struct httpd_request *hreq) { ret = playqueuecontents_add_queue_item(songlist, &queue_item, count, status.plid); if (ret < 0) - goto error; + { + db_queue_enum_end(&qp); + goto error; + } count++; }