From f078026b3c5d63c494381d3573a8107ddd7d78f7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 13 Jan 2021 14:31:00 +0100 Subject: Add SerdBuffer type for mutable buffers This avoids const violations from abusing SerdChunk as a mutable buffer for string sinks. --- test/test_reader_writer.c | 10 +++++----- test/test_writer.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index 8bd09fe2..2d45a5be 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -261,16 +261,16 @@ test_writer(const char* const path) serd_writer_free(writer); - // Test chunk sink - SerdChunk chunk = {NULL, 0}; - writer = serd_writer_new( - SERD_TURTLE, (SerdStyle)0, env, NULL, serd_chunk_sink, &chunk); + // Test buffer sink + SerdBuffer buffer = {NULL, 0}; + writer = serd_writer_new( + SERD_TURTLE, (SerdStyle)0, env, NULL, serd_buffer_sink, &buffer); o = serd_node_from_string(SERD_URI, USTR("http://example.org/base")); assert(!serd_writer_set_base_uri(writer, &o)); serd_writer_free(writer); - uint8_t* out = serd_chunk_sink_finish(&chunk); + uint8_t* out = serd_buffer_sink_finish(&buffer); assert(!strcmp((const char*)out, "@base .\n")); serd_free(out); diff --git a/test/test_writer.c b/test/test_writer.c index 35d0bcf3..472d7345 100644 --- a/test/test_writer.c +++ b/test/test_writer.c @@ -28,9 +28,9 @@ static void test_write_long_literal(void) { SerdEnv* env = serd_env_new(NULL); - SerdChunk chunk = {NULL, 0}; + SerdBuffer buffer = {NULL, 0}; SerdWriter* writer = serd_writer_new( - SERD_TURTLE, (SerdStyle)0, env, NULL, serd_chunk_sink, &chunk); + SERD_TURTLE, (SerdStyle)0, env, NULL, serd_buffer_sink, &buffer); assert(writer); @@ -44,7 +44,7 @@ test_write_long_literal(void) serd_writer_free(writer); serd_env_free(env); - uint8_t* out = serd_chunk_sink_finish(&chunk); + uint8_t* out = serd_buffer_sink_finish(&buffer); static const char* const expected = "\n" -- cgit v1.2.1