aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-26 20:56:46 +0100
committerMax Kellermann <max@duempel.org>2008-10-26 20:56:46 +0100
commit5c19776f2fc1416dab1da2f2baae9a0c764df965 (patch)
tree828f8f768be17f053e12fc38f2a7593e0a9b77b5 /src/decoder
parent464b6117721056e72c79824a298caf53eb5cd452 (diff)
downloadmpd-5c19776f2fc1416dab1da2f2baae9a0c764df965.tar.gz
mpd-5c19776f2fc1416dab1da2f2baae9a0c764df965.tar.xz
mpd-5c19776f2fc1416dab1da2f2baae9a0c764df965.zip
input_stream: use "bool" instead of "int"
For boolean values and success flags, use bool instead of integer (1/0 for true/false, 0/-1 for success/failure).
Diffstat (limited to '')
-rw-r--r--src/decoder/aac_plugin.c4
-rw-r--r--src/decoder/ffmpeg_plugin.c2
-rw-r--r--src/decoder/flac_plugin.c3
-rw-r--r--src/decoder/mp3_plugin.c5
-rw-r--r--src/decoder/mp4_plugin.c5
-rw-r--r--src/decoder/mpc_plugin.c4
-rw-r--r--src/decoder/oggflac_plugin.c5
-rw-r--r--src/decoder/oggvorbis_plugin.c2
-rw-r--r--src/decoder/wavpack_plugin.c10
-rw-r--r--src/decoder_thread.c2
10 files changed, 21 insertions, 21 deletions
diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c
index 017844201..3e8468e9e 100644
--- a/src/decoder/aac_plugin.c
+++ b/src/decoder/aac_plugin.c
@@ -257,7 +257,7 @@ static float getAacFloatTotalTime(char *file)
struct input_stream inStream;
long bread;
- if (input_stream_open(&inStream, file) < 0)
+ if (!input_stream_open(&inStream, file))
return -1;
initAacBuffer(&b, NULL, &inStream);
@@ -461,7 +461,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
if ((totalTime = getAacFloatTotalTime(path)) < 0)
return -1;
- if (input_stream_open(&inStream, path) < 0)
+ if (!input_stream_open(&inStream, path))
return -1;
initAacBuffer(&b, mpd_decoder, &inStream);
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index bc0ffe221..6de31d52a 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -360,7 +360,7 @@ static struct tag *ffmpeg_tag(char *file)
int ret;
struct tag *tag = NULL;
- if (input_stream_open(&input, file) < 0) {
+ if (!input_stream_open(&input, file)) {
ERROR("failed to open %s\n", file);
return NULL;
}
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index f65fef9b9..90313f8f6 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -52,9 +52,8 @@ static flac_seek_status flacSeek(mpd_unused const flac_decoder * flacDec,
{
FlacData *data = (FlacData *) fdata;
- if (input_stream_seek(data->inStream, offset, SEEK_SET) < 0) {
+ if (!input_stream_seek(data->inStream, offset, SEEK_SET))
return flac_seek_status_error;
- }
return flac_seek_status_ok;
}
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index a3b8c5a5a..330ba668f 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -158,9 +158,8 @@ static void initMp3DecodeData(mp3DecodeData * data, struct decoder *decoder,
static int seekMp3InputBuffer(mp3DecodeData * data, long offset)
{
- if (input_stream_seek(data->inStream, offset, SEEK_SET) < 0) {
+ if (!input_stream_seek(data->inStream, offset, SEEK_SET))
return -1;
- }
mad_stream_buffer(&data->stream, data->readBuffer, 0);
(data->stream).error = 0;
@@ -757,7 +756,7 @@ static int getMp3TotalTime(char *file)
mp3DecodeData data;
int ret;
- if (input_stream_open(&inStream, file) < 0)
+ if (!input_stream_open(&inStream, file))
return -1;
initMp3DecodeData(&data, NULL, &inStream);
if (decodeFirstFrame(&data, NULL, NULL) < 0)
diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c
index b5197bb3b..a9fa061d0 100644
--- a/src/decoder/mp4_plugin.c
+++ b/src/decoder/mp4_plugin.c
@@ -75,7 +75,8 @@ static uint32_t mp4_inputStreamReadCallback(void *inStream, void *buffer,
static uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position)
{
return input_stream_seek((struct input_stream *) inStream,
- position, SEEK_SET);
+ position, SEEK_SET)
+ ? 0 : -1;
}
static int
@@ -317,7 +318,7 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
*mp4MetadataFound = 0;
- if (input_stream_open(&inStream, file) < 0) {
+ if (!input_stream_open(&inStream, file)) {
DEBUG("mp4DataDup: Failed to open file: %s\n", file);
return NULL;
}
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c
index 7d792f429..12a11de6b 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -38,7 +38,7 @@ static mpc_bool_t mpc_seek_cb(void *vdata, mpc_int32_t offset)
{
MpcCallbackData *data = (MpcCallbackData *) vdata;
- return input_stream_seek(data->inStream, offset, SEEK_SET) < 0 ? 0 : 1;
+ return input_stream_seek(data->inStream, offset, SEEK_SET) ? 0 : 1;
}
static mpc_int32_t mpc_tell_cb(void *vdata)
@@ -260,7 +260,7 @@ static float mpcGetTime(char *file)
mpc_streaminfo_init(&info);
- if (input_stream_open(&inStream, file) < 0) {
+ if (!input_stream_open(&inStream, file)) {
DEBUG("mpcGetTime: Failed to open file: %s\n", file);
return -1;
}
diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c
index 47a66f6f5..c0f194156 100644
--- a/src/decoder/oggflac_plugin.c
+++ b/src/decoder/oggflac_plugin.c
@@ -64,9 +64,8 @@ static OggFLAC__SeekableStreamDecoderSeekStatus of_seek_cb(mpd_unused const
{
FlacData *data = (FlacData *) fdata;
- if (input_stream_seek(data->inStream, offset, SEEK_SET) < 0) {
+ if (!input_stream_seek(data->inStream, offset, SEEK_SET))
return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
- }
return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK;
}
@@ -261,7 +260,7 @@ static struct tag *oggflac_TagDup(char *file)
OggFLAC__SeekableStreamDecoder *decoder;
FlacData data;
- if (input_stream_open(&inStream, file) < 0)
+ if (!input_stream_open(&inStream, file))
return NULL;
if (ogg_stream_type_detect(&inStream) != FLAC) {
input_stream_close(&inStream);
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index 0eb0380f4..c177fc15e 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -66,7 +66,7 @@ static int ogg_seek_cb(void *vdata, ogg_int64_t offset, int whence)
const OggCallbackData *data = (const OggCallbackData *) vdata;
if(decoder_get_command(data->decoder) == DECODE_COMMAND_STOP)
return -1;
- return input_stream_seek(data->inStream, offset, whence);
+ return input_stream_seek(data->inStream, offset, whence) ? 0 : -1;
}
/* TODO: check Ogg libraries API and see if we can just not have this func */
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index 7a0a2249f..86b01164e 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -366,12 +366,14 @@ static uint32_t get_pos(void *id)
static int set_pos_abs(void *id, uint32_t pos)
{
- return input_stream_seek(((InputStreamPlus *)id)->is, pos, SEEK_SET);
+ return input_stream_seek(((InputStreamPlus *)id)->is, pos, SEEK_SET)
+ ? 0 : -1;
}
static int set_pos_rel(void *id, int32_t delta, int mode)
{
- return input_stream_seek(((InputStreamPlus *)id)->is, delta, mode);
+ return input_stream_seek(((InputStreamPlus *)id)->is, delta, mode)
+ ? 0 : -1;
}
static int push_back_byte(void *id, int c)
@@ -439,7 +441,7 @@ static int wavpack_open_wvc(struct decoder *decoder,
const char *utf8url;
size_t len;
char *wvc_url = NULL;
- int ret;
+ bool ret;
/*
* As we use dc->utf8url, this function will be bad for
@@ -464,7 +466,7 @@ static int wavpack_open_wvc(struct decoder *decoder,
ret = input_stream_open(is_wvc, wvc_url);
free(wvc_url);
- if (ret)
+ if (!ret)
return 0;
/*
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index 3c56dfbcb..68dbd4bb1 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -43,7 +43,7 @@ static void decodeStart(void)
song_get_url(song, path_max_fs);
dc.current_song = dc.next_song; /* NEED LOCK */
- if (input_stream_open(&inStream, path_max_fs) < 0) {
+ if (!input_stream_open(&inStream, path_max_fs)) {
dc.error = DECODE_ERROR_FILE;
goto stop_no_close;
}