aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-30 08:38:54 +0100
committerMax Kellermann <max@duempel.org>2008-10-30 08:38:54 +0100
commit62d4fa9306fdb5dd0a1b592fd8dbdf1b679d92ca (patch)
tree565dd0a8c2c50a31dac369408e6b499eb7daafb5 /src/decoder_thread.c
parentd29bad441066919f808c4ad1657bc5600fd9bd45 (diff)
downloadmpd-62d4fa9306fdb5dd0a1b592fd8dbdf1b679d92ca.tar.gz
mpd-62d4fa9306fdb5dd0a1b592fd8dbdf1b679d92ca.tar.xz
mpd-62d4fa9306fdb5dd0a1b592fd8dbdf1b679d92ca.zip
decoder: use bool for return values and flags
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
Diffstat (limited to '')
-rw-r--r--src/decoder_thread.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index 3bbe1f347..e26e2e534 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -73,12 +73,12 @@ static void decodeStart(void)
if (dc.command == DECODE_COMMAND_STOP)
goto stop;
- ret = DECODE_ERROR_UNKTYPE;
+ ret = false;
if (!song_is_file(song)) {
unsigned int next = 0;
/* first we try mime types: */
- while (ret && (plugin = decoder_plugin_from_mime_type(inStream.mime, next++))) {
+ while ((plugin = decoder_plugin_from_mime_type(inStream.mime, next++))) {
if (plugin->stream_decode == NULL)
continue;
if (!(plugin->stream_types & INPUT_PLUGIN_STREAM_URL))
@@ -94,7 +94,7 @@ static void decodeStart(void)
if (plugin == NULL) {
const char *s = getSuffix(path_max_fs);
next = 0;
- while (ret && (plugin = decoder_plugin_from_suffix(s, next++))) {
+ while ((plugin = decoder_plugin_from_suffix(s, next++))) {
if (plugin->stream_decode == NULL)
continue;
if (!(plugin->stream_types &
@@ -124,7 +124,7 @@ static void decodeStart(void)
} else {
unsigned int next = 0;
const char *s = getSuffix(path_max_fs);
- while (ret && (plugin = decoder_plugin_from_suffix(s, next++))) {
+ while ((plugin = decoder_plugin_from_suffix(s, next++))) {
if (!plugin->stream_types & INPUT_PLUGIN_STREAM_FILE)
continue;
@@ -150,11 +150,10 @@ static void decodeStart(void)
ob_flush();
- if (ret < 0 || ret == DECODE_ERROR_UNKTYPE) {
- if (ret != DECODE_ERROR_UNKTYPE)
- dc.error = DECODE_ERROR_FILE;
- else
- dc.error = DECODE_ERROR_UNKTYPE;
+ if (!ret) {
+ dc.error = plugin == NULL
+ ? DECODE_ERROR_UNKTYPE
+ : DECODE_ERROR_FILE;
}
stop: