aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/oggvorbis_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/oggvorbis_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 '')
-rw-r--r--src/decoder/oggvorbis_plugin.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index 2099d2c0f..f4c6de7fe 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -96,7 +96,7 @@ static const char *ogg_parseComment(const char *comment, const char *needle)
static void ogg_getReplayGainInfo(char **comments, ReplayGainInfo ** infoPtr)
{
const char *temp;
- int found = 0;
+ bool found = false;
if (*infoPtr)
freeReplayGainInfo(*infoPtr);
@@ -106,19 +106,19 @@ static void ogg_getReplayGainInfo(char **comments, ReplayGainInfo ** infoPtr)
if ((temp =
ogg_parseComment(*comments, "replaygain_track_gain"))) {
(*infoPtr)->trackGain = atof(temp);
- found = 1;
+ found = true;
} else if ((temp = ogg_parseComment(*comments,
"replaygain_album_gain"))) {
(*infoPtr)->albumGain = atof(temp);
- found = 1;
+ found = true;
} else if ((temp = ogg_parseComment(*comments,
"replaygain_track_peak"))) {
(*infoPtr)->trackPeak = atof(temp);
- found = 1;
+ found = true;
} else if ((temp = ogg_parseComment(*comments,
"replaygain_album_peak"))) {
(*infoPtr)->albumPeak = atof(temp);
- found = 1;
+ found = true;
}
comments++;
@@ -200,7 +200,7 @@ static void putOggCommentsIntoOutputBuffer(char *streamName,
}
/* public */
-static int
+static bool
oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
{
OggVorbis_File vf;
@@ -218,7 +218,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
ReplayGainInfo *replayGainInfo = NULL;
char **comments;
const char *errorStr;
- int initialized = 0;
+ bool initialized = false;
data.inStream = inStream;
data.decoder = decoder;
@@ -229,7 +229,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
callbacks.tell_func = ogg_tell_cb;
if ((ret = ov_open_callbacks(&data, &vf, NULL, 0, callbacks)) < 0) {
if (decoder_get_command(decoder) != DECODE_COMMAND_NONE)
- return 0;
+ return true;
switch (ret) {
case OV_EREAD:
@@ -253,11 +253,11 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
}
ERROR("Error decoding Ogg Vorbis stream: %s\n",
errorStr);
- return -1;
+ return false;
}
audio_format.bits = 16;
- while (1) {
+ while (true) {
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
double seek_where = decoder_seek_where(decoder);
if (0 == ov_time_seek_page(&vf, seek_where)) {
@@ -280,7 +280,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
total_time = 0;
decoder_initialized(decoder, &audio_format,
total_time);
- initialized = 1;
+ initialized = true;
}
comments = ov_comment(&vf, -1)->user_comments;
putOggCommentsIntoOutputBuffer(inStream->meta_name,
@@ -326,7 +326,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
freeReplayGainInfo(replayGainInfo);
ov_clear(&vf);
- return 0;
+ return true;
}
static struct tag *oggvorbis_TagDup(char *file)