use the "bool" data type instead of "int"

"bool" should be used in C99 programs for boolean values.
This commit is contained in:
Max Kellermann
2008-10-08 11:03:39 +02:00
parent 71351160b1
commit b084bc28ed
20 changed files with 74 additions and 65 deletions

View File

@@ -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 };

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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 };

View File

@@ -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,