aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-11 17:13:44 +0100
committerMax Kellermann <max@duempel.org>2008-11-11 17:13:44 +0100
commit9eed41911f5b65bb51d2395388439918e799cade (patch)
tree7d9ce92fe427b7049fc50087923b5fa8ecb53eff /src/decoder_thread.c
parent05e69ac0868658411123f8c549b7f34c2c478742 (diff)
downloadmpd-9eed41911f5b65bb51d2395388439918e799cade.tar.gz
mpd-9eed41911f5b65bb51d2395388439918e799cade.tar.xz
mpd-9eed41911f5b65bb51d2395388439918e799cade.zip
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.
Diffstat (limited to '')
-rw-r--r--src/decoder_thread.c34
1 files changed, 8 insertions, 26 deletions
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)