From 27bfcda20de83e14f015017f2a7402342112a4af Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 11 Nov 2015 17:21:26 +0100 Subject: decoder/Control: use switch/case in Seek() --- src/decoder/DecoderControl.cxx | 15 +++++++++++++-- 1 file 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; -- cgit v1.2.3