diff options
author | Max Kellermann <max@duempel.org> | 2008-09-07 13:44:12 +0200 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-09 01:11:00 -0700 |
commit | 38526852f3c40a6014f86b832b37d31507f6131b (patch) | |
tree | f8eddfff4a11598c0e5cf6f465e4a08af3be644b /src/command.c | |
parent | 6dcd7fea0e3cfc8f51097f11c0c84793584e8f0b (diff) | |
download | mpd-38526852f3c40a6014f86b832b37d31507f6131b.tar.gz mpd-38526852f3c40a6014f86b832b37d31507f6131b.tar.xz mpd-38526852f3c40a6014f86b832b37d31507f6131b.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.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/command.c b/src/command.c index a4d785126..1634394d0 100644 --- a/src/command.c +++ b/src/command.c @@ -529,7 +529,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, @@ -573,7 +576,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, @@ -732,11 +738,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, @@ -744,13 +752,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, @@ -1135,7 +1145,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, @@ -1143,11 +1156,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) |