aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-03-15 23:21:34 -0400
committerDavid Robillard <d@drobilla.net>2018-05-27 18:18:30 +0200
commit9b3d8263604ba11ae008c8651a1fe2063296d6b1 (patch)
tree9747d428f34f73e5d2e9e72bd8edef50b05ddad9 /src/writer.c
parenta0c483d9f1f3955499560ef1536fdb760df274fb (diff)
downloadserd-9b3d8263604ba11ae008c8651a1fe2063296d6b1.tar.gz
serd-9b3d8263604ba11ae008c8651a1fe2063296d6b1.tar.bz2
serd-9b3d8263604ba11ae008c8651a1fe2063296d6b1.zip
Use SerdBuffer for mutable buffers
This avoids const violations from abusing SerdChunk as a mutable buffer for string sinks.
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/writer.c b/src/writer.c
index 603ca65e..26bf5e5a 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -976,19 +976,19 @@ serd_file_sink(const void* buf, size_t len, void* stream)
SERD_API
size_t
-serd_chunk_sink(const void* buf, size_t len, void* stream)
+serd_buffer_sink(const void* buf, size_t len, void* stream)
{
- SerdChunk* chunk = (SerdChunk*)stream;
- chunk->buf = (uint8_t*)realloc((uint8_t*)chunk->buf, chunk->len + len);
- memcpy((uint8_t*)chunk->buf + chunk->len, buf, len);
- chunk->len += len;
+ SerdBuffer* buffer = (SerdBuffer*)stream;
+ buffer->buf = (char*)realloc(buffer->buf, buffer->len + len);
+ memcpy((uint8_t*)buffer->buf + buffer->len, buf, len);
+ buffer->len += len;
return len;
}
SERD_API
uint8_t*
-serd_chunk_sink_finish(SerdChunk* stream)
+serd_buffer_sink_finish(SerdBuffer* stream)
{
- serd_chunk_sink("", 1, stream);
+ serd_buffer_sink("", 1, stream);
return (uint8_t*)stream->buf;
}