From 9eed41911f5b65bb51d2395388439918e799cade Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 11 Nov 2008 17:13:44 +0100 Subject: decoder: return void from decode() methods The stream_decode() and file_decode() methods returned a boolean, indicating whether they were able to decode the song. This is redundant, since we already know that: if decoder_initialized() has been called (and dc.state==DECODE), the plugin succeeded. Change both methods to return void. --- src/decoder_thread.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'src/decoder_thread.c') diff --git a/src/decoder_thread.c b/src/decoder_thread.c index 99c76f892..28dbcaa8e 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -33,8 +33,6 @@ decoder_stream_decode(const struct decoder_plugin *plugin, struct decoder *decoder, struct input_stream *input_stream) { - bool ret; - assert(plugin != NULL); assert(plugin->stream_decode != NULL); assert(decoder != NULL); @@ -46,27 +44,18 @@ decoder_stream_decode(const struct decoder_plugin *plugin, /* rewind the stream, so each plugin gets a fresh start */ input_stream_seek(input_stream, 0, SEEK_SET); - ret = plugin->stream_decode(decoder, input_stream); + plugin->stream_decode(decoder, input_stream); - if (ret) { - /* if the method has succeeded, the plugin must have - called decoder_initialized() */ - assert(dc.state == DECODE_STATE_DECODE); - } else { - /* no decoder_initialized() allowed when the plugin - hasn't recognized the file format */ - assert(dc.state == DECODE_STATE_START); - } + assert(dc.state == DECODE_STATE_START || + dc.state == DECODE_STATE_DECODE); - return ret; + return dc.state != DECODE_STATE_START; } static bool decoder_file_decode(const struct decoder_plugin *plugin, struct decoder *decoder, const char *path) { - bool ret; - assert(plugin != NULL); assert(plugin->stream_decode != NULL); assert(decoder != NULL); @@ -75,19 +64,12 @@ decoder_file_decode(const struct decoder_plugin *plugin, assert(path[0] == '/'); assert(dc.state == DECODE_STATE_START); - ret = plugin->file_decode(decoder, path); + plugin->file_decode(decoder, path); - if (ret) { - /* if the method has succeeded, the plugin must have - called decoder_initialized() */ - assert(dc.state == DECODE_STATE_DECODE); - } else { - /* no decoder_initialized() allowed when the plugin - hasn't recognized the file format */ - assert(dc.state == DECODE_STATE_START); - } + assert(dc.state == DECODE_STATE_START || + dc.state == DECODE_STATE_DECODE); - return ret; + return dc.state != DECODE_STATE_START; } static void decoder_run(void) -- cgit v1.2.3