aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_source.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-11-25 18:08:54 +0100
committerDavid Robillard <d@drobilla.net>2019-01-05 17:12:38 +0100
commitd4e594b0825391db76d72fbf092451d86ebe66c2 (patch)
tree948e8d2fc87b7275fe9b54715123d36cb6b4353c /src/byte_source.h
parentd493841ad1ae145db53b04d4d8eeb21fe6a2a438 (diff)
downloadserd-d4e594b0825391db76d72fbf092451d86ebe66c2.tar.gz
serd-d4e594b0825391db76d72fbf092451d86ebe66c2.tar.bz2
serd-d4e594b0825391db76d72fbf092451d86ebe66c2.zip
Remove reader status and handle errors more precisely
Diffstat (limited to 'src/byte_source.h')
-rw-r--r--src/byte_source.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/byte_source.h b/src/byte_source.h
index f88fa6c9..4dfff70f 100644
--- a/src/byte_source.h
+++ b/src/byte_source.h
@@ -87,13 +87,14 @@ serd_byte_source_advance(SerdByteSource* source)
}
if (source->from_stream) {
- source->eof = false;
if (source->page_size > 1) {
if (++source->read_head == source->page_size) {
+ source->eof = false;
st = serd_byte_source_page(source);
}
} else {
if (!source->read_func(&source->read_byte, 1, 1, source->stream)) {
+ source->eof = true;
st = source->error_func(source->stream) ? SERD_ERR_UNKNOWN
: SERD_FAILURE;
}
@@ -102,7 +103,7 @@ serd_byte_source_advance(SerdByteSource* source)
++source->read_head; // Move to next character in string
}
- return source->eof ? SERD_FAILURE : st;
+ return st ? st : source->eof ? SERD_FAILURE : SERD_SUCCESS;
}
#endif // SERD_BYTE_SOURCE_H