From 228b03edf8513aa1cdaf4e4647279cc580245555 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 14 Nov 2009 23:53:04 +0100 Subject: input_stream: return errors with GError --- src/decoder_api.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/decoder_api.c') 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; -- cgit v1.2.3