From 9c637df77ec245518922c5aeb076ae52c89598d0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 4 Feb 2014 01:15:08 +0100 Subject: [PATCH] SongSticker: add Database reference parameter --- src/command/StickerCommands.cxx | 2 +- src/sticker/SongSticker.cxx | 7 ++----- src/sticker/SongSticker.hxx | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/command/StickerCommands.cxx b/src/command/StickerCommands.cxx index 5234e2da8..ee772475f 100644 --- a/src/command/StickerCommands.cxx +++ b/src/command/StickerCommands.cxx @@ -133,7 +133,7 @@ handle_sticker_song(Client &client, int argc, char *argv[]) argv[4], }; - success = sticker_song_find(base_uri, data.name, + success = sticker_song_find(*db, base_uri, data.name, sticker_song_find_print_cb, &data); if (!success) { command_error(client, ACK_ERROR_SYSTEM, diff --git a/src/sticker/SongSticker.cxx b/src/sticker/SongSticker.cxx index 4bcc8979f..7246ec69f 100644 --- a/src/sticker/SongSticker.cxx +++ b/src/sticker/SongSticker.cxx @@ -21,7 +21,6 @@ #include "SongSticker.hxx" #include "StickerDatabase.hxx" #include "db/LightSong.hxx" -#include "db/DatabaseGlue.hxx" #include "db/DatabasePlugin.hxx" #include "util/Error.hxx" @@ -95,15 +94,13 @@ sticker_song_find_cb(const char *uri, const char *value, void *user_data) } bool -sticker_song_find(const char *base_uri, const char *name, +sticker_song_find(const Database &db, const char *base_uri, const char *name, void (*func)(const LightSong &song, const char *value, void *user_data), void *user_data) { struct sticker_song_find_data data; - data.db = GetDatabase(); - assert(data.db != nullptr); - + data.db = &db; data.func = func; data.user_data = user_data; diff --git a/src/sticker/SongSticker.hxx b/src/sticker/SongSticker.hxx index a49674150..5956cd6f9 100644 --- a/src/sticker/SongSticker.hxx +++ b/src/sticker/SongSticker.hxx @@ -25,8 +25,8 @@ #include struct LightSong; -struct Directory; struct sticker; +class Database; /** * Returns one value from a song's sticker record. The caller must @@ -78,7 +78,7 @@ sticker_song_get(const LightSong &song); * failure */ bool -sticker_song_find(const char *base_uri, const char *name, +sticker_song_find(const Database &db, const char *base_uri, const char *name, void (*func)(const LightSong &song, const char *value, void *user_data), void *user_data);