From b084bc28ede5d397e88a4e2bdad8c07a55069589 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Oct 2008 11:03:39 +0200 Subject: use the "bool" data type instead of "int" "bool" should be used in C99 programs for boolean values. --- src/inputPlugins/flac_plugin.c | 4 ++-- src/inputPlugins/mp4_plugin.c | 14 +++++++------- src/inputPlugins/oggflac_plugin.c | 6 +++--- src/inputPlugins/oggvorbis_plugin.c | 6 +++--- src/inputPlugins/wavpack_plugin.c | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/inputPlugins') diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index 0b4fbf27e..cd8a8efd3 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -427,9 +427,9 @@ static int oggflac_decode(struct decoder *decoder, InputStream * inStream) return flac_decode_internal(decoder, inStream, 1); } -static unsigned int oggflac_try_decode(InputStream * inStream) +static bool oggflac_try_decode(InputStream * inStream) { - return (ogg_stream_type_detect(inStream) == FLAC) ? 1 : 0; + return ogg_stream_type_detect(inStream) == FLAC; } static const char *oggflac_suffixes[] = { "ogg", "oga", NULL }; diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 1a4c495d6..6a2d167b2 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -103,12 +103,12 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) unsigned int initial = 1; float *seekTable; long seekTableEnd = -1; - int seekPositionFound = 0; + bool seekPositionFound = false; long offset; uint16_t bitRate = 0; - int seeking = 0; + bool seeking = false; double seek_where = 0; - int initialized = 0; + bool initialized = false; mp4cb = xmalloc(sizeof(mp4ff_callback_t)); mp4cb->read = mp4_inputStreamReadCallback; @@ -189,7 +189,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) for (sampleId = 0; sampleId < numSamples; sampleId++) { if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { - seeking = 1; + seeking = true; seek_where = decoder_seek_where(mpd_decoder); } @@ -219,10 +219,10 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) file_time += ((float)dur) / scale; if (seeking && file_time > seek_where) - seekPositionFound = 1; + seekPositionFound = true; if (seeking && seekPositionFound) { - seekPositionFound = 0; + seekPositionFound = false; decoder_clear(mpd_decoder); seeking = 0; decoder_command_finished(mpd_decoder); @@ -259,7 +259,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) audio_format.channels = frameInfo.channels; decoder_initialized(mpd_decoder, &audio_format, total_time); - initialized = 1; + initialized = true; } if (channels * (unsigned long)(dur + offset) > frameInfo.samples) { diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index ea36cb82b..3a2db5c03 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -283,14 +283,14 @@ static struct tag *oggflac_TagDup(char *file) return data.tag; } -static unsigned int oggflac_try_decode(InputStream * inStream) +static bool oggflac_try_decode(InputStream * inStream) { if (!inStream->seekable) /* we cannot seek after the detection, so don't bother checking */ - return 1; + return true; - return (ogg_stream_type_detect(inStream) == FLAC) ? 1 : 0; + return ogg_stream_type_detect(inStream) == FLAC; } static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream) diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index a01556cb3..0e1d523b9 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -365,14 +365,14 @@ static struct tag *oggvorbis_TagDup(char *file) return ret; } -static unsigned int oggvorbis_try_decode(InputStream * inStream) +static bool oggvorbis_try_decode(InputStream * inStream) { if (!inStream->seekable) /* we cannot seek after the detection, so don't bother checking */ - return 1; + return true; - return (ogg_stream_type_detect(inStream) == VORBIS) ? 1 : 0; + return ogg_stream_type_detect(inStream) == VORBIS; } static const char *oggvorbis_Suffixes[] = { "ogg","oga", NULL }; diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index e98eb7365..af7c3a2f3 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -417,7 +417,7 @@ initInputStreamPlus(InputStreamPlus *isp, struct decoder *decoder, /* * Tries to decode the specified stream, and gives true if managed to do it. */ -static unsigned int wavpack_trydecode(InputStream *is) +static bool wavpack_trydecode(InputStream *is) { char error[ERRORLEN]; WavpackContext *wpc; @@ -427,13 +427,13 @@ static unsigned int wavpack_trydecode(InputStream *is) wpc = WavpackOpenFileInputEx(&mpd_is_reader, &isp, NULL, error, OPEN_STREAMING, 0); if (wpc == NULL) - return 0; + return false; WavpackCloseFile(wpc); /* Seek it back in order to play from the first byte. */ seekInputStream(is, 0, SEEK_SET); - return 1; + return true; } static int wavpack_open_wvc(struct decoder *decoder, -- cgit v1.2.3