aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-04-24 21:41:46 +0200
committerDavid Robillard <d@drobilla.net>2017-04-24 21:41:46 +0200
commit52d36530ef5bfd1b2be810a1ade6e034b76aa097 (patch)
treecf1a34d1f1c51508b1fd0a253609eebc428efbd3 /src/reader.c
parent1c9b402f041067a321a5f59ff0bcd7238e0ab9fe (diff)
downloadserd-52d36530ef5bfd1b2be810a1ade6e034b76aa097.tar.gz
serd-52d36530ef5bfd1b2be810a1ade6e034b76aa097.tar.bz2
serd-52d36530ef5bfd1b2be810a1ade6e034b76aa097.zip
Allow arbitrary page size to be passed for custom sources
Diffstat (limited to 'src/reader.c')
-rw-r--r--src/reader.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/reader.c b/src/reader.c
index 6b99ebf0..29526223 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1834,7 +1834,7 @@ serd_reader_start_stream(SerdReader* me,
(SerdStreamErrorFunc)ferror,
file,
name,
- bulk);
+ bulk ? SERD_PAGE_SIZE : 1);
}
SERD_API
@@ -1844,13 +1844,13 @@ serd_reader_start_source_stream(SerdReader* me,
SerdStreamErrorFunc error_func,
void* stream,
const uint8_t* name,
- bool bulk)
+ size_t page_size)
{
const Cursor cur = { name, 1, 1 };
me->cur = cur;
return serd_byte_source_open_source(
- &me->source, read_func, error_func, stream, bulk);
+ &me->source, read_func, error_func, stream, page_size);
}
static SerdStatus
@@ -1895,7 +1895,8 @@ SerdStatus
serd_reader_read_file_handle(SerdReader* me, FILE* file, const uint8_t* name)
{
return serd_reader_read_source(
- me, (SerdSource)fread, (SerdStreamErrorFunc)ferror, file, name);
+ me, (SerdSource)fread, (SerdStreamErrorFunc)ferror,
+ file, name, SERD_PAGE_SIZE);
}
SERD_API
@@ -1904,10 +1905,11 @@ serd_reader_read_source(SerdReader* me,
SerdSource source,
SerdStreamErrorFunc error,
void* stream,
- const uint8_t* name)
+ const uint8_t* name,
+ size_t page_size)
{
SerdStatus st = serd_reader_start_source_stream(
- me, source, error, stream, name, true);
+ me, source, error, stream, name, page_size);
if ((st = serd_reader_prepare(me))) {
serd_reader_end_stream(me);