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/PlaylistFile.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 '')
-rw-r--r-- | src/PlaylistFile.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx index 5e14e7ec7..c5a298868 100644 --- a/src/PlaylistFile.cxx +++ b/src/PlaylistFile.cxx @@ -90,7 +90,7 @@ spl_map(Error &error) { const AllocatedPath &path_fs = map_spl_path(); if (path_fs.IsNull()) - error.Set(playlist_domain, PLAYLIST_RESULT_DISABLED, + error.Set(playlist_domain, int(PlaylistResult::DISABLED), "Stored playlists are disabled"); return path_fs; } @@ -99,7 +99,7 @@ static bool spl_check_name(const char *name_utf8, Error &error) { if (!spl_valid_name(name_utf8)) { - error.Set(playlist_domain, PLAYLIST_RESULT_BAD_NAME, + error.Set(playlist_domain, int(PlaylistResult::BAD_NAME), "Bad playlist name"); return false; } @@ -115,7 +115,7 @@ spl_map_to_fs(const char *name_utf8, Error &error) auto path_fs = map_spl_utf8_to_fs(name_utf8); if (path_fs.IsNull()) - error.Set(playlist_domain, PLAYLIST_RESULT_BAD_NAME, + error.Set(playlist_domain, int(PlaylistResult::BAD_NAME), "Bad playlist name"); return path_fs; @@ -129,7 +129,7 @@ playlist_errno(Error &error) { switch (errno) { case ENOENT: - error.Set(playlist_domain, PLAYLIST_RESULT_NO_SUCH_LIST, + error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_LIST), "No such playlist"); break; @@ -287,7 +287,7 @@ spl_move_index(const char *utf8path, unsigned src, unsigned dest, return false; if (src >= contents.size() || dest >= contents.size()) { - error.Set(playlist_domain, PLAYLIST_RESULT_BAD_RANGE, + error.Set(playlist_domain, int(PlaylistResult::BAD_RANGE), "Bad range"); return false; } @@ -351,7 +351,7 @@ spl_remove_index(const char *utf8path, unsigned pos, Error &error) return false; if (pos >= contents.size()) { - error.Set(playlist_domain, PLAYLIST_RESULT_BAD_RANGE, + error.Set(playlist_domain, int(PlaylistResult::BAD_RANGE), "Bad range"); return false; } @@ -389,7 +389,7 @@ spl_append_song(const char *utf8path, const Song &song, Error &error) if (st.st_size / off_t(MPD_PATH_MAX + 1) >= (off_t)playlist_max_length) { fclose(file); - error.Set(playlist_domain, PLAYLIST_RESULT_TOO_LARGE, + error.Set(playlist_domain, int(PlaylistResult::TOO_LARGE), "Stored playlist is too large"); return false; } @@ -430,13 +430,13 @@ spl_rename_internal(Path from_path_fs, Path to_path_fs, Error &error) { if (!FileExists(from_path_fs)) { - error.Set(playlist_domain, PLAYLIST_RESULT_NO_SUCH_LIST, + error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_LIST), "No such playlist"); return false; } if (FileExists(to_path_fs)) { - error.Set(playlist_domain, PLAYLIST_RESULT_LIST_EXISTS, + error.Set(playlist_domain, int(PlaylistResult::LIST_EXISTS), "Playlist exists already"); return false; } |