diff options
author | Max Kellermann <max@duempel.org> | 2013-10-19 19:50:54 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-20 13:06:40 +0200 |
commit | c772bc45c60be3f559cdd42a9628f37f15da0a17 (patch) | |
tree | 2a30c33f17c6be05510af649027aafea805417ae /src/CommandError.cxx | |
parent | c1e7be3b8e4ab5fb99587b8e5f262ce41805f892 (diff) | |
download | mpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.tar.gz mpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.tar.xz mpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.zip |
PlaylistError: convert playlist_result to a strictly-typed enum
Diffstat (limited to 'src/CommandError.cxx')
-rw-r--r-- | src/CommandError.cxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/CommandError.cxx b/src/CommandError.cxx index d606f5df9..f22ad10de 100644 --- a/src/CommandError.cxx +++ b/src/CommandError.cxx @@ -30,55 +30,55 @@ #include <errno.h> enum command_return -print_playlist_result(Client &client, enum playlist_result result) +print_playlist_result(Client &client, PlaylistResult result) { switch (result) { - case PLAYLIST_RESULT_SUCCESS: + case PlaylistResult::SUCCESS: return COMMAND_RETURN_OK; - case PLAYLIST_RESULT_ERRNO: + case PlaylistResult::ERRNO: command_error(client, ACK_ERROR_SYSTEM, "%s", g_strerror(errno)); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_DENIED: + case PlaylistResult::DENIED: command_error(client, ACK_ERROR_PERMISSION, "Access denied"); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_NO_SUCH_SONG: + case PlaylistResult::NO_SUCH_SONG: command_error(client, ACK_ERROR_NO_EXIST, "No such song"); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_NO_SUCH_LIST: + case PlaylistResult::NO_SUCH_LIST: command_error(client, ACK_ERROR_NO_EXIST, "No such playlist"); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_LIST_EXISTS: + case PlaylistResult::LIST_EXISTS: command_error(client, ACK_ERROR_EXIST, "Playlist already exists"); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_BAD_NAME: + case PlaylistResult::BAD_NAME: command_error(client, ACK_ERROR_ARG, "playlist name is invalid: " "playlist names may not contain slashes," " newlines or carriage returns"); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_BAD_RANGE: + case PlaylistResult::BAD_RANGE: command_error(client, ACK_ERROR_ARG, "Bad song index"); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_NOT_PLAYING: + case PlaylistResult::NOT_PLAYING: command_error(client, ACK_ERROR_PLAYER_SYNC, "Not playing"); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_TOO_LARGE: + case PlaylistResult::TOO_LARGE: command_error(client, ACK_ERROR_PLAYLIST_MAX, "playlist is at the max size"); return COMMAND_RETURN_ERROR; - case PLAYLIST_RESULT_DISABLED: + case PlaylistResult::DISABLED: command_error(client, ACK_ERROR_UNKNOWN, "stored playlist support is disabled"); return COMMAND_RETURN_ERROR; @@ -97,7 +97,7 @@ print_error(Client &client, const Error &error) if (error.IsDomain(playlist_domain)) { return print_playlist_result(client, - playlist_result(error.GetCode())); + PlaylistResult(error.GetCode())); } else if (error.IsDomain(ack_domain)) { command_error(client, (ack)error.GetCode(), "%s", error.GetMessage()); |