aboutsummaryrefslogtreecommitdiffstats
path: root/src/PlaylistCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-19 19:50:54 +0200
committerMax Kellermann <max@duempel.org>2013-10-20 13:06:40 +0200
commitc772bc45c60be3f559cdd42a9628f37f15da0a17 (patch)
tree2a30c33f17c6be05510af649027aafea805417ae /src/PlaylistCommands.cxx
parentc1e7be3b8e4ab5fb99587b8e5f262ce41805f892 (diff)
downloadmpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.tar.gz
mpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.tar.xz
mpd-c772bc45c60be3f559cdd42a9628f37f15da0a17.zip
PlaylistError: convert playlist_result to a strictly-typed enum
Diffstat (limited to 'src/PlaylistCommands.cxx')
-rw-r--r--src/PlaylistCommands.cxx21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/PlaylistCommands.cxx b/src/PlaylistCommands.cxx
index 4eaaf8145..02c21e01f 100644
--- a/src/PlaylistCommands.cxx
+++ b/src/PlaylistCommands.cxx
@@ -52,9 +52,7 @@ print_spl_list(Client &client, const PlaylistVector &list)
enum command_return
handle_save(Client &client, gcc_unused int argc, char *argv[])
{
- enum playlist_result result;
-
- result = spl_save_playlist(argv[1], client.playlist);
+ PlaylistResult result = spl_save_playlist(argv[1], client.playlist);
return print_playlist_result(client, result);
}
@@ -69,13 +67,12 @@ handle_load(Client &client, int argc, char *argv[])
} else if (!check_range(client, &start_index, &end_index, argv[2]))
return COMMAND_RETURN_ERROR;
- enum playlist_result result;
-
- result = playlist_open_into_queue(argv[1],
- start_index, end_index,
- client.playlist,
- client.player_control, true);
- if (result != PLAYLIST_RESULT_NO_SUCH_LIST)
+ const PlaylistResult result =
+ playlist_open_into_queue(argv[1],
+ start_index, end_index,
+ client.playlist,
+ client.player_control, true);
+ if (result != PlaylistResult::NO_SUCH_LIST)
return print_playlist_result(client, result);
Error error;
@@ -85,12 +82,12 @@ handle_load(Client &client, int argc, char *argv[])
return COMMAND_RETURN_OK;
if (error.IsDomain(playlist_domain) &&
- error.GetCode() == PLAYLIST_RESULT_BAD_NAME) {
+ PlaylistResult(error.GetCode()) == PlaylistResult::BAD_NAME) {
/* the message for BAD_NAME is confusing when the
client wants to load a playlist file from the music
directory; patch the Error object to show "no such
playlist" instead */
- Error error2(playlist_domain, PLAYLIST_RESULT_NO_SUCH_LIST,
+ Error error2(playlist_domain, int(PlaylistResult::NO_SUCH_LIST),
error.GetMessage());
error = std::move(error2);
}