aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:44:12 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 13:44:12 +0200
commita8b225f947fc2d5e464222ea9b535c49fbce9ac9 (patch)
treed729d63421e38d9223771729a2fa9b862e94aab0 /src/command.c
parent8d2830b3f9ab52e1b2dd54d82ae3aaf39e61abe8 (diff)
downloadmpd-a8b225f947fc2d5e464222ea9b535c49fbce9ac9.tar.gz
mpd-a8b225f947fc2d5e464222ea9b535c49fbce9ac9.tar.xz
mpd-a8b225f947fc2d5e464222ea9b535c49fbce9ac9.zip
playlist: don't pass "fd" to storedPlaylist.c functions
Return an "enum playlist_result" value instead of calling commandError() in storedPlaylist.c.
Diffstat (limited to '')
-rw-r--r--src/command.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/command.c b/src/command.c
index e9dc83ccb..6bdfba58b 100644
--- a/src/command.c
+++ b/src/command.c
@@ -531,7 +531,10 @@ static int handleSave(int fd, mpd_unused int *permission,
static int handleLoad(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- return loadPlaylist(fd, argv[1]);
+ enum playlist_result result;
+
+ result = loadPlaylist(fd, argv[1]);
+ return print_playlist_result(fd, result);
}
static int handleListPlaylist(int fd, mpd_unused int *permission,
@@ -575,7 +578,10 @@ static int handleRm(int fd, mpd_unused int *permission,
static int handleRename(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- return renameStoredPlaylist(fd, argv[1], argv[2]);
+ enum playlist_result result;
+
+ result = renameStoredPlaylist(argv[1], argv[2]);
+ return print_playlist_result(fd, result);
}
static int handlePlaylistChanges(int fd, mpd_unused int *permission,
@@ -734,11 +740,13 @@ static int handlePlaylistDelete(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[]) {
char *playlist = argv[1];
int from;
+ enum playlist_result result;
if (check_int(fd, &from, argv[2], check_integer, argv[2]) < 0)
return -1;
- return removeOneSongFromStoredPlaylistByPath(fd, playlist, from);
+ result = removeOneSongFromStoredPlaylistByPath(playlist, from);
+ return print_playlist_result(fd, result);
}
static int handlePlaylistMove(int fd, mpd_unused int *permission,
@@ -746,13 +754,15 @@ static int handlePlaylistMove(int fd, mpd_unused int *permission,
{
char *playlist = argv[1];
int from, to;
+ enum playlist_result result;
if (check_int(fd, &from, argv[2], check_integer, argv[2]) < 0)
return -1;
if (check_int(fd, &to, argv[3], check_integer, argv[3]) < 0)
return -1;
- return moveSongInStoredPlaylistByPath(fd, playlist, from, to);
+ result = moveSongInStoredPlaylistByPath(playlist, from, to);
+ return print_playlist_result(fd, result);
}
static int listHandleUpdate(int fd,
@@ -1137,7 +1147,10 @@ static int handleNotcommands(int fd, mpd_unused int *permission,
static int handlePlaylistClear(int fd, mpd_unused int *permission,
mpd_unused int argc, char *argv[])
{
- return clearStoredPlaylist(fd, argv[1]);
+ enum playlist_result result;
+
+ result = clearStoredPlaylist(argv[1]);
+ return print_playlist_result(fd, result);
}
static int handlePlaylistAdd(int fd, mpd_unused int *permission,
@@ -1145,11 +1158,13 @@ static int handlePlaylistAdd(int fd, mpd_unused int *permission,
{
char *playlist = argv[1];
char *path = argv[2];
+ enum playlist_result result;
if (isRemoteUrl(path))
- return addToStoredPlaylist(fd, path, playlist);
-
- return addAllInToStoredPlaylist(fd, path, playlist);
+ result = addToStoredPlaylist(path, playlist);
+ else
+ result = addAllInToStoredPlaylist(fd, path, playlist);
+ return print_playlist_result(fd, result);
}
void initCommands(void)