diff options
author | Max Kellermann <max@duempel.org> | 2015-11-11 17:21:26 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-11-11 17:46:03 +0100 |
commit | 27bfcda20de83e14f015017f2a7402342112a4af (patch) | |
tree | b7661448f97e541c529b13e92916fd47bfb9b1f5 | |
parent | c6d1d360a3b7034c661bb348fda732177192390f (diff) | |
download | mpd-27bfcda20de83e14f015017f2a7402342112a4af.tar.gz mpd-27bfcda20de83e14f015017f2a7402342112a4af.tar.xz mpd-27bfcda20de83e14f015017f2a7402342112a4af.zip |
decoder/Control: use switch/case in Seek()
-rw-r--r-- | src/decoder/DecoderControl.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/decoder/DecoderControl.cxx b/src/decoder/DecoderControl.cxx index a4fe570b2..648e816d8 100644 --- a/src/decoder/DecoderControl.cxx +++ b/src/decoder/DecoderControl.cxx @@ -109,8 +109,19 @@ DecoderControl::Seek(SongTime t) { assert(state != DecoderState::START); - if (state == DecoderState::STOP || - state == DecoderState::ERROR || !seekable) + switch (state) { + case DecoderState::START: + gcc_unreachable(); + + case DecoderState::ERROR: + case DecoderState::STOP: + return false; + + case DecoderState::DECODE: + break; + } + + if (!seekable) return false; seek_time = t; |