diff options
author | Max Kellermann <max@duempel.org> | 2008-10-30 08:38:54 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-30 08:38:54 +0100 |
commit | 62d4fa9306fdb5dd0a1b592fd8dbdf1b679d92ca (patch) | |
tree | 565dd0a8c2c50a31dac369408e6b499eb7daafb5 /src/decoder/mpc_plugin.c | |
parent | d29bad441066919f808c4ad1657bc5600fd9bd45 (diff) | |
download | mpd-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/mpc_plugin.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c index f9c3f34d5..ed7f49fc7 100644 --- a/src/decoder/mpc_plugin.c +++ b/src/decoder/mpc_plugin.c @@ -94,7 +94,7 @@ static inline int16_t convertSample(MPC_SAMPLE_FORMAT sample) return val; } -static int +static bool mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) { mpc_decoder decoder; @@ -106,7 +106,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH]; - int eof = 0; + bool eof = false; long ret; #define MPC_CHUNK_SIZE 4096 char chunk[MPC_CHUNK_SIZE]; @@ -135,9 +135,9 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) if ((ret = mpc_streaminfo_read(&info, &reader)) != ERROR_CODE_OK) { if (decoder_get_command(mpd_decoder) != DECODE_COMMAND_STOP) { ERROR("Not a valid musepack stream\n"); - return -1; + return false; } - return 0; + return true; } mpc_decoder_setup(&decoder, &reader); @@ -145,9 +145,9 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) if (!mpc_decoder_initialize(&decoder, &info)) { if (decoder_get_command(mpd_decoder) != DECODE_COMMAND_STOP) { ERROR("Not a valid musepack stream\n"); - return -1; + return false; } - return 0; + return true; } audio_format.bits = 16; @@ -181,7 +181,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) &vbrUpdateAcc, &vbrUpdateBits); if (ret <= 0 || decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP) { - eof = 1; + eof = true; break; } @@ -212,7 +212,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) chunkpos = 0; s16 = (int16_t *) chunk; if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_STOP) { - eof = 1; + eof = true; break; } } @@ -233,7 +233,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream) freeReplayGainInfo(replayGainInfo); - return 0; + return true; } static float mpcGetTime(char *file) |