diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/reader.c | 13 | ||||
-rw-r--r-- | src/serdi.c | 2 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/reader.c b/src/reader.c index c1c2a1bd..4424c61c 100644 --- a/src/reader.c +++ b/src/reader.c @@ -158,6 +158,7 @@ eat_byte(SerdReader* reader, const uint8_t byte) const uint8_t c = peek_byte(reader); ++reader->read_head; switch (c) { + case '\0': reader->eof = true; break; case '\n': ++reader->cur.line; reader->cur.col = 0; break; default: ++reader->cur.col; } @@ -169,9 +170,6 @@ eat_byte(SerdReader* reader, const uint8_t byte) TRY_RET(page(reader)); assert(reader->read_head < SERD_PAGE_SIZE); } - if (reader->read_buf[reader->read_head] == '\0') { - reader->eof = true; - } return c; } @@ -1204,9 +1202,6 @@ read_objectList(SerdReader* reader, ReadContext ctx, bool blank) static bool read_predicateObjectList(SerdReader* reader, ReadContext ctx, bool blank) { - if (reader->eof) { - return false; - } Ref predicate = 0; TRY_RET(read_verb(reader, &predicate)); TRY_THROW(read_ws_plus(reader)); @@ -1394,10 +1389,10 @@ read_statement(SerdReader* reader) SerdStatementFlags flags = 0; ReadContext ctx = { 0, 0, 0, &flags }; read_ws_star(reader); - if (reader->eof) { - return true; - } switch (peek_byte(reader)) { + case '\0': + reader->eof = true; + return true; case '@': TRY_RET(read_directive(reader)); break; diff --git a/src/serdi.c b/src/serdi.c index 6020a271..c5183008 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -155,7 +155,7 @@ main(int argc, char** argv) if (from_file) { in_name = in_name ? in_name : input; if (!in_fd) { - input = serd_uri_to_path(input); + input = serd_uri_to_path(in_name); if (!(in_fd = serd_fopen((const char*)input, "r"))) { return 1; } |