diff options
author | David Robillard <d@drobilla.net> | 2018-06-03 22:15:53 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-12-31 11:37:47 -0500 |
commit | 5246440bc489b9b8168d0e26700cf5f343895169 (patch) | |
tree | 345fd9e2916a0e92205186e011721d9c8459c047 /src/reader.c | |
parent | c10db88a4eac181e83acff319e77308291c59645 (diff) | |
download | serd-5246440bc489b9b8168d0e26700cf5f343895169.tar.gz serd-5246440bc489b9b8168d0e26700cf5f343895169.tar.bz2 serd-5246440bc489b9b8168d0e26700cf5f343895169.zip |
Add SerdCursor to public API
Diffstat (limited to 'src/reader.c')
-rw-r--r-- | src/reader.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/reader.c b/src/reader.c index 40c48a41..79e2315e 100644 --- a/src/reader.c +++ b/src/reader.c @@ -39,8 +39,7 @@ r_err(SerdReader* reader, SerdStatus st, const char* 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.cur, fmt, &args }; serd_world_error(reader->world, &e); va_end(args); return st; @@ -246,7 +245,7 @@ serd_reader_start_stream(SerdReader* reader, SerdReadFunc read_func, SerdStreamErrorFunc error_func, void* stream, - const char* name, + const SerdNode* name, 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( + SerdNode* const name = serd_new_uri(uri); + const SerdStatus st = serd_byte_source_open_source( &reader->source, bulk ? (SerdReadFunc)fread : serd_file_read_byte, (SerdStreamErrorFunc)ferror, (SerdStreamCloseFunc)fclose, fd, - uri, + name, bulk ? SERD_PAGE_SIZE : 1); + serd_node_free(name); + return st; } SerdStatus -serd_reader_start_string(SerdReader* reader, const char* utf8) +serd_reader_start_string(SerdReader* reader, + const char* utf8, + const SerdNode* name) { - return serd_byte_source_open_string(&reader->source, utf8); + return serd_byte_source_open_string(&reader->source, utf8, name); } static SerdStatus |