aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_source.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-10-27 19:48:02 +0100
committerDavid Robillard <d@drobilla.net>2019-10-27 22:41:27 +0100
commitf7ffff1e75634909da60ea63a7c52f1a001220b8 (patch)
treed14587114d96a0be8408709c1f315412440d078d /src/byte_source.c
parentcd6d4569c1c8819cc8e54eefdc0ac389d8efb4ea (diff)
downloadserd-f7ffff1e75634909da60ea63a7c52f1a001220b8.tar.gz
serd-f7ffff1e75634909da60ea63a7c52f1a001220b8.tar.bz2
serd-f7ffff1e75634909da60ea63a7c52f1a001220b8.zip
Fix EOF handling while reading in bulk or from strings
Diffstat (limited to 'src/byte_source.c')
-rw-r--r--src/byte_source.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/byte_source.c b/src/byte_source.c
index 1a67157b..210e638e 100644
--- a/src/byte_source.c
+++ b/src/byte_source.c
@@ -29,6 +29,7 @@ serd_byte_source_page(SerdByteSource* source)
? SERD_ERR_UNKNOWN : SERD_FAILURE);
} else if (n_read < source->page_size) {
source->file_buf[n_read] = '\0';
+ source->buf_size = n_read;
}
return SERD_SUCCESS;
}
@@ -47,6 +48,7 @@ serd_byte_source_open_source(SerdByteSource* source,
source->stream = stream;
source->from_stream = true;
source->page_size = page_size;
+ source->buf_size = page_size;
source->cur = cur;
source->error_func = error_func;
source->read_func = read_func;