summaryrefslogtreecommitdiff
path: root/src/decoder/flac_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/flac_plugin.c
parentd29bad441066919f808c4ad1657bc5600fd9bd45 (diff)
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/flac_plugin.c')
-rw-r--r--src/decoder/flac_plugin.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index dd933ce6b..a4ccd6ebb 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -219,13 +219,14 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
return flac_common_write(data, frame, buf);
}
-static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
+static struct tag *
+flacMetadataDup(char *file, bool *vorbisCommentFound)
{
struct tag *ret = NULL;
FLAC__Metadata_SimpleIterator *it;
FLAC__StreamMetadata *block = NULL;
- *vorbisCommentFound = 0;
+ *vorbisCommentFound = false;
it = FLAC__metadata_simple_iterator_new();
if (!FLAC__metadata_simple_iterator_init(it, file, 1, 0)) {
@@ -262,7 +263,7 @@ static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
ret = copyVorbisCommentBlockToMpdTag(block, ret);
if (ret)
- *vorbisCommentFound = 1;
+ *vorbisCommentFound = true;
} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
if (!ret)
ret = tag_new();
@@ -280,7 +281,7 @@ static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
static struct tag *flacTagDup(char *file)
{
struct tag *ret = NULL;
- int foundVorbisComment = 0;
+ bool foundVorbisComment = false;
ret = flacMetadataDup(file, &foundVorbisComment);
if (!ret) {
@@ -300,16 +301,16 @@ static struct tag *flacTagDup(char *file)
return ret;
}
-static int
+static bool
flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
- int is_ogg)
+ bool is_ogg)
{
flac_decoder *flacDec;
FlacData data;
const char *err = NULL;
if (!(flacDec = flac_new()))
- return -1;
+ return false;
init_FlacData(&data, decoder, inStream);
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
@@ -342,7 +343,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
decoder_initialized(decoder, &data.audio_format, data.total_time);
- while (1) {
+ while (true) {
if (!flac_process_single(flacDec))
break;
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
@@ -372,15 +373,15 @@ fail:
if (err) {
ERROR("flac %s\n", err);
- return -1;
+ return false;
}
- return 0;
+ return true;
}
-static int
+static bool
flac_decode(struct decoder * decoder, struct input_stream *inStream)
{
- return flac_decode_internal(decoder, inStream, 0);
+ return flac_decode_internal(decoder, inStream, false);
}
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
@@ -415,10 +416,10 @@ out:
return ret;
}
-static int
+static bool
oggflac_decode(struct decoder *decoder, struct input_stream *inStream)
{
- return flac_decode_internal(decoder, inStream, 1);
+ return flac_decode_internal(decoder, inStream, true);
}
static bool