aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-11 07:41:25 +0200
committerMax Kellermann <max@duempel.org>2011-09-11 07:57:50 +0200
commitca419c84b83d017c3e4309e22f92273500197eea (patch)
tree495a1a68c3bc4b0d1fbd2efb30985d31e14fe18d /src/dbUtils.c
parentaede71b1dcda4dacc566f11d47188c85a3ee8dd2 (diff)
downloadmpd-ca419c84b83d017c3e4309e22f92273500197eea.tar.gz
mpd-ca419c84b83d017c3e4309e22f92273500197eea.tar.xz
mpd-ca419c84b83d017c3e4309e22f92273500197eea.zip
stored_playlist: return GError, code is playlist_result
Improve error reporting and handling. command.c gets the new function print_error(), which sends a GError to the client.
Diffstat (limited to 'src/dbUtils.c')
-rw-r--r--src/dbUtils.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 9334196c6..e0d8c5379 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -36,6 +36,7 @@ directoryAddSongToPlaylist(struct song *song, void *data)
struct add_data {
const char *path;
+ GError **error_r;
};
static int
@@ -43,8 +44,10 @@ directoryAddSongToStoredPlaylist(struct song *song, void *_data)
{
struct add_data *data = _data;
- if (spl_append_song(data->path, song) != 0)
+ if (!spl_append_song(data->path, song, data->error_r)) {
return -1;
+ }
+
return 0;
}
@@ -54,13 +57,16 @@ addAllIn(struct player_control *pc, const char *name)
return db_walk(name, directoryAddSongToPlaylist, NULL, pc);
}
-int addAllInToStoredPlaylist(const char *name, const char *utf8file)
+bool
+addAllInToStoredPlaylist(const char *name, const char *utf8file,
+ GError **error_r)
{
struct add_data data = {
.path = utf8file,
+ .error_r = error_r,
};
- return db_walk(name, directoryAddSongToStoredPlaylist, NULL, &data);
+ return db_walk(name, directoryAddSongToStoredPlaylist, NULL, &data) == 0;
}
struct find_add_data {