diff options
author | Max Kellermann <max@duempel.org> | 2013-08-10 18:02:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-09-04 18:14:22 +0200 |
commit | 29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch) | |
tree | 79766830b55ebca38ddbce84d8d548227eedb69e /src/StickerCommands.cxx | |
parent | c9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff) | |
download | mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip |
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to '')
-rw-r--r-- | src/StickerCommands.cxx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/StickerCommands.cxx b/src/StickerCommands.cxx index 5cbb7e984..5fdc0ba15 100644 --- a/src/StickerCommands.cxx +++ b/src/StickerCommands.cxx @@ -29,6 +29,9 @@ #include "StickerDatabase.hxx" #include "CommandError.hxx" #include "protocol/Result.hxx" +#include "util/Error.hxx" + +#include <glib.h> #include <string.h> @@ -39,7 +42,7 @@ struct sticker_song_find_data { static void sticker_song_find_print_cb(Song *song, const char *value, - gpointer user_data) + void *user_data) { struct sticker_song_find_data *data = (struct sticker_song_find_data *)user_data; @@ -51,14 +54,14 @@ sticker_song_find_print_cb(Song *song, const char *value, static enum command_return handle_sticker_song(Client *client, int argc, char *argv[]) { - GError *error = nullptr; - const Database *db = GetDatabase(&error); + Error error; + const Database *db = GetDatabase(error); if (db == nullptr) return print_error(client, error); /* get song song_id key */ if (argc == 5 && strcmp(argv[1], "get") == 0) { - Song *song = db->GetSong(argv[3], &error); + Song *song = db->GetSong(argv[3], error); if (song == nullptr) return print_error(client, error); @@ -76,7 +79,7 @@ handle_sticker_song(Client *client, int argc, char *argv[]) return COMMAND_RETURN_OK; /* list song song_id */ } else if (argc == 4 && strcmp(argv[1], "list") == 0) { - Song *song = db->GetSong(argv[3], &error); + Song *song = db->GetSong(argv[3], error); if (song == nullptr) return print_error(client, error); @@ -90,7 +93,7 @@ handle_sticker_song(Client *client, int argc, char *argv[]) return COMMAND_RETURN_OK; /* set song song_id id key */ } else if (argc == 6 && strcmp(argv[1], "set") == 0) { - Song *song = db->GetSong(argv[3], &error); + Song *song = db->GetSong(argv[3], error); if (song == nullptr) return print_error(client, error); @@ -106,7 +109,7 @@ handle_sticker_song(Client *client, int argc, char *argv[]) /* delete song song_id [key] */ } else if ((argc == 4 || argc == 5) && strcmp(argv[1], "delete") == 0) { - Song *song = db->GetSong(argv[3], &error); + Song *song = db->GetSong(argv[3], error); if (song == nullptr) return print_error(client, error); |