diff options
author | David Robillard <d@drobilla.net> | 2018-11-25 18:08:54 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-04-13 19:48:23 +0200 |
commit | 5443876d8e15c6ad011ede7d46ed36325a6cb282 (patch) | |
tree | 69fbb26e35f44a6d49d60c4a8969e6d2cca63a3e /src/byte_source.h | |
parent | 3b1252125ca66387f904ce107fb4c6130d5c582d (diff) | |
download | serd-5443876d8e15c6ad011ede7d46ed36325a6cb282.tar.gz serd-5443876d8e15c6ad011ede7d46ed36325a6cb282.tar.bz2 serd-5443876d8e15c6ad011ede7d46ed36325a6cb282.zip |
Remove reader status and handle errors more precisely
Diffstat (limited to 'src/byte_source.h')
-rw-r--r-- | src/byte_source.h | 5 |
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 |