aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/mod_plugin.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/mod_plugin.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 'src/decoder/mod_plugin.c')
-rw-r--r--src/decoder/mod_plugin.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/decoder/mod_plugin.c b/src/decoder/mod_plugin.c
index bdf71ec37..3f120abf4 100644
--- a/src/decoder/mod_plugin.c
+++ b/src/decoder/mod_plugin.c
@@ -91,18 +91,18 @@ static MDRIVER drv_mpd = {
VC_VoiceRealVolume
};
-static int mod_mikModInitiated;
-static int mod_mikModInitError;
+static bool mod_mikModInitiated;
+static bool mod_mikModInitError;
-static int mod_initMikMod(void)
+static bool mod_initMikMod(void)
{
static char params[] = "";
if (mod_mikModInitError)
- return -1;
+ return false;
if (!mod_mikModInitiated) {
- mod_mikModInitiated = 1;
+ mod_mikModInitiated = true;
md_device = 0;
md_reverb = 0;
@@ -119,11 +119,11 @@ static int mod_initMikMod(void)
if (MikMod_Init(params)) {
ERROR("Could not init MikMod: %s\n",
MikMod_strerror(MikMod_errno));
- mod_mikModInitError = 1;
- return -1;
+ mod_mikModInitError = true;
+ return false;
}
- return 0;
+ return true;
}
static void mod_finishMikMod(void)
@@ -165,7 +165,8 @@ static void mod_close(mod_Data * data)
free(data);
}
-static int mod_decode(struct decoder * decoder, char *path)
+static bool
+mod_decode(struct decoder *decoder, char *path)
{
mod_Data *data;
struct audio_format audio_format;
@@ -173,13 +174,13 @@ static int mod_decode(struct decoder * decoder, char *path)
int ret;
float secPerByte;
- if (mod_initMikMod() < 0)
- return -1;
+ if (!mod_initMikMod())
+ return false;
if (!(data = mod_open(path))) {
ERROR("failed to open mod: %s\n", path);
MikMod_Exit();
- return -1;
+ return false;
}
audio_format.bits = 16;
@@ -192,7 +193,7 @@ static int mod_decode(struct decoder * decoder, char *path)
decoder_initialized(decoder, &audio_format, 0);
- while (1) {
+ while (true) {
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
decoder_seek_error(decoder);
}
@@ -214,7 +215,7 @@ static int mod_decode(struct decoder * decoder, char *path)
MikMod_Exit();
- return 0;
+ return true;
}
static struct tag *modTagDup(char *file)
@@ -223,7 +224,7 @@ static struct tag *modTagDup(char *file)
MODULE *moduleHandle;
char *title;
- if (mod_initMikMod() < 0) {
+ if (!mod_initMikMod()) {
DEBUG("modTagDup: Failed to initialize MikMod\n");
return NULL;
}