diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-06-04 01:58:31 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-06-04 01:58:31 +0000 |
commit | f958e0a4c5bb7241b2ec443a402d10c29abfc08f (patch) | |
tree | aeaaf910ae09cffaa0289223503f12dcdfcb8245 /src/playlist.c | |
parent | d22e5ec5228ccb3f6fd843cebc4662953f42451d (diff) |
work on ACK error codes
git-svn-id: https://svn.musicpd.org/mpd/trunk@1324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/playlist.c')
-rw-r--r-- | src/playlist.c | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/src/playlist.c b/src/playlist.c index d1691b5ed..9c8755216 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -375,7 +375,7 @@ int playlistInfo(FILE * fp,int song) { end = song+1; } if(song>=playlist.length) { - commandError(fp, "song doesn't exist"); + commandError(fp, "song doesn't exist: \"%i\"", song); return -1; } @@ -535,11 +535,11 @@ int swapSongsInPlaylist(FILE * fp, int song1, int song2) { int currentSong = -1; if(song1<0 || song1>=playlist.length) { - commandError(fp,"\"%i\" is not in the playlist", song1); + commandError(fp, "song doesn't exist: \"%i\"", song1); return -1; } if(song2<0 || song2>=playlist.length) { - commandError(fp, "\"%i\" is not in the playlist", song2); + commandError(fp, "song doesn't exist: \"%i\"", song2); return -1; } @@ -585,12 +585,8 @@ int deleteFromPlaylist(FILE * fp, int song) { int i; int songOrder; - if(song<0) { - commandError(fp, "need a positive integer"); - return -1; - } - if(song>=playlist.length) { - commandError(fp, "song doesn't exist"); + if(song<0 || song>=playlist.length) { + commandError(fp, "song doesn't exist: \"%i\"", song); return -1; } @@ -713,18 +709,8 @@ int playPlaylist(FILE * fp, int song, int stopOnError) { i = 0; } } - else if(song<0) { - commandError(fp, "need integer >= -1"); - playlist_state = PLAYLIST_STATE_STOP; - return -1; - } - if(!playlist.length) { - commandError(fp, "playlist is empty"); - playlist_state = PLAYLIST_STATE_STOP; - return -1; - } - else if(song>=playlist.length) { - commandError(fp, "song doesn't exist"); + else if(song<0 || song>=playlist.length) { + commandError(fp, "song doesn't exist: \"%i\"", song); playlist_state = PLAYLIST_STATE_STOP; return -1; } @@ -869,12 +855,12 @@ int moveSongInPlaylist(FILE * fp, int from, int to) { int currentSong = -1; if(from<0 || from>=playlist.length) { - commandError(fp, "\"%i\" is not a song in the playlist", from); + commandError(fp, "song doesn't exist: \"%i\"", from); return -1; } if(to<0 || to>=playlist.length) { - commandError(fp, "\"%i\" is not a song in the playlist", to); + commandError(fp, "song doesn't exist: \"%i\"", to); return -1; } @@ -1253,16 +1239,8 @@ int getPlaylistLength() { int seekSongInPlaylist(FILE * fp, int song, float time) { int i = song; - if(song<0) { - commandError(fp, "need integer >= -1"); - return -1; - } - if(!playlist.length) { - commandError(fp, "playlist is empty"); - return -1; - } - else if(song>=playlist.length) { - commandError(fp, "song doesn't exist"); + if(song<0 || song>=playlist.length) { + commandError(fp, "song doesn't exist: \"%i\"", song); return -1; } |