aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/SongSticker.cxx35
-rw-r--r--src/SongSticker.hxx10
-rw-r--r--src/UpdateRemove.cxx2
-rw-r--r--src/command/StickerCommands.cxx10
4 files changed, 26 insertions, 31 deletions
diff --git a/src/SongSticker.cxx b/src/SongSticker.cxx
index a0c4d3585..88bea1501 100644
--- a/src/SongSticker.cxx
+++ b/src/SongSticker.cxx
@@ -29,53 +29,48 @@
#include <string.h>
std::string
-sticker_song_get_value(const Song *song, const char *name)
+sticker_song_get_value(const Song &song, const char *name)
{
- assert(song != nullptr);
- assert(song->IsInDatabase());
+ assert(song.IsInDatabase());
- const auto uri = song->GetURI();
+ const auto uri = song.GetURI();
return sticker_load_value("song", uri.c_str(), name);
}
bool
-sticker_song_set_value(const Song *song,
+sticker_song_set_value(const Song &song,
const char *name, const char *value)
{
- assert(song != nullptr);
- assert(song->IsInDatabase());
+ assert(song.IsInDatabase());
- const auto uri = song->GetURI();
+ const auto uri = song.GetURI();
return sticker_store_value("song", uri.c_str(), name, value);
}
bool
-sticker_song_delete(const Song *song)
+sticker_song_delete(const Song &song)
{
- assert(song != nullptr);
- assert(song->IsInDatabase());
+ assert(song.IsInDatabase());
- const auto uri = song->GetURI();
+ const auto uri = song.GetURI();
return sticker_delete("song", uri.c_str());
}
bool
-sticker_song_delete_value(const Song *song, const char *name)
+sticker_song_delete_value(const Song &song, const char *name)
{
- assert(song != nullptr);
- assert(song->IsInDatabase());
+ assert(song.IsInDatabase());
- const auto uri = song->GetURI();
+ const auto uri = song.GetURI();
return sticker_delete_value("song", uri.c_str(), name);
}
struct sticker *
-sticker_song_get(const Song *song)
+sticker_song_get(const Song &song)
{
- assert(song != nullptr);
- assert(song->IsInDatabase());
+ assert(song.IsInDatabase());
- const auto uri = song->GetURI();
+ const auto uri = song.GetURI();
return sticker_load("song", uri.c_str());
}
diff --git a/src/SongSticker.hxx b/src/SongSticker.hxx
index 7a63a64b4..a5de90517 100644
--- a/src/SongSticker.hxx
+++ b/src/SongSticker.hxx
@@ -34,28 +34,28 @@ struct sticker;
*/
gcc_pure
std::string
-sticker_song_get_value(const Song *song, const char *name);
+sticker_song_get_value(const Song &song, const char *name);
/**
* Sets a sticker value in the specified song. Overwrites existing
* values.
*/
bool
-sticker_song_set_value(const Song *song,
+sticker_song_set_value(const Song &song,
const char *name, const char *value);
/**
* Deletes a sticker from the database. All values are deleted.
*/
bool
-sticker_song_delete(const Song *song);
+sticker_song_delete(const Song &song);
/**
* Deletes a sticker value. Does nothing if the sticker did not
* exist.
*/
bool
-sticker_song_delete_value(const Song *song, const char *name);
+sticker_song_delete_value(const Song &song, const char *name);
/**
* Loads the sticker for the specified song.
@@ -64,7 +64,7 @@ sticker_song_delete_value(const Song *song, const char *name);
* @return a sticker object, or NULL on error or if there is no sticker
*/
sticker *
-sticker_song_get(const Song *song);
+sticker_song_get(const Song &song);
/**
* Finds stickers with the specified name below the specified
diff --git a/src/UpdateRemove.cxx b/src/UpdateRemove.cxx
index 555b340d3..91588330a 100644
--- a/src/UpdateRemove.cxx
+++ b/src/UpdateRemove.cxx
@@ -57,7 +57,7 @@ song_remove_event(void)
#ifdef ENABLE_SQLITE
/* if the song has a sticker, remove it */
if (sticker_enabled())
- sticker_song_delete(removed_song);
+ sticker_song_delete(*removed_song);
#endif
instance->DeleteSong(*removed_song);
diff --git a/src/command/StickerCommands.cxx b/src/command/StickerCommands.cxx
index d353a5541..e5451d260 100644
--- a/src/command/StickerCommands.cxx
+++ b/src/command/StickerCommands.cxx
@@ -63,7 +63,7 @@ handle_sticker_song(Client &client, int argc, char *argv[])
if (song == nullptr)
return print_error(client, error);
- const auto value = sticker_song_get_value(song, argv[4]);
+ const auto value = sticker_song_get_value(*song, argv[4]);
db->ReturnSong(song);
if (value.empty()) {
command_error(client, ACK_ERROR_NO_EXIST,
@@ -80,7 +80,7 @@ handle_sticker_song(Client &client, int argc, char *argv[])
if (song == nullptr)
return print_error(client, error);
- sticker *sticker = sticker_song_get(song);
+ sticker *sticker = sticker_song_get(*song);
db->ReturnSong(song);
if (sticker) {
sticker_print(client, *sticker);
@@ -94,7 +94,7 @@ handle_sticker_song(Client &client, int argc, char *argv[])
if (song == nullptr)
return print_error(client, error);
- bool ret = sticker_song_set_value(song, argv[4], argv[5]);
+ bool ret = sticker_song_set_value(*song, argv[4], argv[5]);
db->ReturnSong(song);
if (!ret) {
command_error(client, ACK_ERROR_SYSTEM,
@@ -111,8 +111,8 @@ handle_sticker_song(Client &client, int argc, char *argv[])
return print_error(client, error);
bool ret = argc == 4
- ? sticker_song_delete(song)
- : sticker_song_delete_value(song, argv[4]);
+ ? sticker_song_delete(*song)
+ : sticker_song_delete_value(*song, argv[4]);
db->ReturnSong(song);
if (!ret) {
command_error(client, ACK_ERROR_SYSTEM,