aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:17 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:17 +0200
commit2a06e2dafaf9889ad111300e09e922b0dacfdbda (patch)
tree5da85b9d81be17dd2490326f836c078f50740ba1
parent110cef6fda704ae9ea806c13ef346de6a1059a9f (diff)
downloadmpd-2a06e2dafaf9889ad111300e09e922b0dacfdbda.tar.gz
mpd-2a06e2dafaf9889ad111300e09e922b0dacfdbda.tar.xz
mpd-2a06e2dafaf9889ad111300e09e922b0dacfdbda.zip
use switch/case in syncPlaylistWithQueue()
-rw-r--r--src/playlist.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/playlist.c b/src/playlist.c
index e5aad2ed8..3108ba9f2 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -507,22 +507,32 @@ static void queueNextSongInPlaylist(void)
static void syncPlaylistWithQueue(int queue)
{
- if (queue && getPlayerQueueState() == PLAYER_QUEUE_BLANK) {
- queueNextSongInPlaylist();
- } else if (getPlayerQueueState() == PLAYER_QUEUE_DECODE) {
- if (playlist.queued != -1)
- setQueueState(PLAYER_QUEUE_PLAY);
- else
- setQueueState(PLAYER_QUEUE_STOP);
- } else if (getPlayerQueueState() == PLAYER_QUEUE_EMPTY) {
+ switch (getPlayerQueueState()) {
+ case PLAYER_QUEUE_EMPTY:
setQueueState(PLAYER_QUEUE_BLANK);
if (playlist.queued >= 0) {
DEBUG("playlist: now playing queued song\n");
playlist.current = playlist.queued;
}
playlist.queued = -1;
+ /* intentionally no break here */
+
+ case PLAYER_QUEUE_BLANK:
if (queue)
queueNextSongInPlaylist();
+ break;
+
+ case PLAYER_QUEUE_DECODE:
+ if (playlist.queued != -1)
+ setQueueState(PLAYER_QUEUE_PLAY);
+ else
+ setQueueState(PLAYER_QUEUE_STOP);
+ break;
+
+ case PLAYER_QUEUE_FULL:
+ case PLAYER_QUEUE_PLAY:
+ case PLAYER_QUEUE_STOP:
+ break;
}
}