diff options
author | David Robillard <d@drobilla.net> | 2018-11-25 18:08:54 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-01-05 17:12:38 +0100 |
commit | d4e594b0825391db76d72fbf092451d86ebe66c2 (patch) | |
tree | 948e8d2fc87b7275fe9b54715123d36cb6b4353c /src/byte_source.h | |
parent | d493841ad1ae145db53b04d4d8eeb21fe6a2a438 (diff) | |
download | serd-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.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 |