diff options
Diffstat (limited to 'src/reader.c')
-rw-r--r-- | src/reader.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/reader.c b/src/reader.c index 2cdf18c6..9957e55c 100644 --- a/src/reader.c +++ b/src/reader.c @@ -37,8 +37,7 @@ r_err(SerdReader* const reader, const SerdStatus st, const char* const fmt, ...) { va_list args; va_start(args, fmt); - const Cursor* const cur = &reader->source.cur; - const SerdError e = {st, cur->filename, cur->line, cur->col, fmt, &args}; + const SerdError e = {st, &reader->source.caret, fmt, &args}; serd_world_error(reader->world, &e); va_end(args); return st; @@ -246,7 +245,7 @@ serd_reader_start_stream(SerdReader* const reader, const SerdReadFunc read_func, const SerdStreamErrorFunc error_func, void* const stream, - const char* const name, + const SerdNode* const name, const size_t page_size) { return serd_byte_source_open_source( @@ -267,20 +266,25 @@ serd_reader_start_file(SerdReader* reader, const char* uri, bool bulk) return SERD_ERR_UNKNOWN; } - return serd_byte_source_open_source(&reader->source, - bulk ? (SerdReadFunc)fread - : serd_file_read_byte, - (SerdStreamErrorFunc)ferror, - (SerdStreamCloseFunc)fclose, - fd, - uri, - bulk ? SERD_PAGE_SIZE : 1); + SerdNode* const name = serd_new_uri(SERD_STRING(uri)); + const SerdStatus st = serd_byte_source_open_source( + &reader->source, + bulk ? (SerdReadFunc)fread : serd_file_read_byte, + (SerdStreamErrorFunc)ferror, + (SerdStreamCloseFunc)fclose, + fd, + name, + bulk ? SERD_PAGE_SIZE : 1u); + serd_node_free(name); + return st; } SerdStatus -serd_reader_start_string(SerdReader* const reader, const char* const utf8) +serd_reader_start_string(SerdReader* const reader, + const char* const utf8, + const SerdNode* const name) { - return serd_byte_source_open_string(&reader->source, utf8); + return serd_byte_source_open_string(&reader->source, utf8, name); } static SerdStatus |