input_stream: return errors with GError

This commit is contained in:
Max Kellermann
2009-11-14 23:53:04 +01:00
parent d000d31355
commit 228b03edf8
36 changed files with 422 additions and 175 deletions

View File

@@ -57,6 +57,7 @@ text_input_stream_free(struct text_input_stream *tis)
const char *
text_input_stream_read(struct text_input_stream *tis)
{
GError *error = NULL;
void *dest;
const char *src, *p;
size_t length, nbytes;
@@ -67,9 +68,15 @@ text_input_stream_read(struct text_input_stream *tis)
do {
dest = fifo_buffer_write(tis->buffer, &length);
if (dest != NULL) {
nbytes = input_stream_read(tis->is, dest, length);
nbytes = input_stream_read(tis->is, dest, length,
&error);
if (nbytes > 0)
fifo_buffer_append(tis->buffer, nbytes);
else if (error != NULL) {
g_warning("%s", error->message);
g_error_free(error);
return NULL;
}
}
src = fifo_buffer_read(tis->buffer, &length);