aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/reader.c14
-rw-r--r--src/serdi.c2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/reader.c b/src/reader.c
index 41e0fb7d..333aabde 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -98,7 +98,7 @@ error(SerdReader* reader, const char* fmt, ...)
return 0;
}
-static inline bool
+static inline SerdStatus
page(SerdReader* reader)
{
reader->read_head = 0;
@@ -106,11 +106,11 @@ page(SerdReader* reader)
if (n_read == 0) {
reader->read_buf[0] = '\0';
reader->eof = true;
- return false;
+ return ferror(reader->fd) ? SERD_ERR_UNKNOWN : SERD_FAILURE;
} else if (n_read < SERD_PAGE_SIZE) {
reader->read_buf[n_read] = '\0';
}
- return true;
+ return SERD_SUCCESS;
}
static inline uint8_t
@@ -1461,16 +1461,16 @@ serd_reader_read_file_handle(SerdReader* me, FILE* file, const uint8_t* name)
memset(me->read_buf, '\0', SERD_PAGE_SIZE);
- bool ret = page(me);
- if (ret) {
+ SerdStatus st = page(me);
+ if (!st) {
skip_bom(me);
- ret = read_turtleDoc(me);
+ st = read_turtleDoc(me) ? SERD_SUCCESS : SERD_ERR_UNKNOWN;
}
free(me->read_buf);
me->fd = 0;
me->read_buf = NULL;
- return ret ? SERD_SUCCESS : SERD_ERR_UNKNOWN;
+ return st;
}
SERD_API
diff --git a/src/serdi.c b/src/serdi.c
index 63822e94..661b60e0 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -215,5 +215,5 @@ main(int argc, char** argv)
serd_env_free(env);
serd_node_free(&base_uri_node);
- return (status == SERD_SUCCESS) ? 0 : 1;
+ return (status > SERD_FAILURE) ? 1 : 0;
}