aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_api.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-14 23:53:04 +0100
committerMax Kellermann <max@duempel.org>2009-12-15 23:12:11 +0100
commit228b03edf8513aa1cdaf4e4647279cc580245555 (patch)
tree7f5b03a9727fb8c371885469296eb7f49f6fa68b /src/decoder_api.c
parentd000d31355c824a076324b647a3f056aab9ddabe (diff)
downloadmpd-228b03edf8513aa1cdaf4e4647279cc580245555.tar.gz
mpd-228b03edf8513aa1cdaf4e4647279cc580245555.tar.xz
mpd-228b03edf8513aa1cdaf4e4647279cc580245555.zip
input_stream: return errors with GError
Diffstat (limited to 'src/decoder_api.c')
-rw-r--r--src/decoder_api.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index 5f0425ce1..73b01533f 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -154,6 +154,7 @@ size_t decoder_read(struct decoder *decoder,
{
const struct decoder_control *dc =
decoder != NULL ? decoder->dc : NULL;
+ GError *error = NULL;
size_t nbytes;
assert(decoder == NULL ||
@@ -176,7 +177,14 @@ size_t decoder_read(struct decoder *decoder,
dc->command != DECODE_COMMAND_NONE)
return 0;
- nbytes = input_stream_read(is, buffer, length);
+ nbytes = input_stream_read(is, buffer, length, &error);
+
+ if (G_UNLIKELY(nbytes == 0 && error != NULL)) {
+ g_warning("%s", error->message);
+ g_error_free(error);
+ return 0;
+ }
+
if (nbytes > 0 || input_stream_eof(is))
return nbytes;