From 82f8f804773b10c42b17a30872a59ed76b062794 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 | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'test/test_reader_writer.c') diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index 0555e7bb..bb27cf3e 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -514,16 +514,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, "http://example.org/base"); assert(!serd_writer_set_base_uri(writer, &o)); serd_writer_free(writer); - char* out = serd_chunk_sink_finish(&chunk); + char* out = serd_buffer_sink_finish(&buffer); assert(!strcmp(out, "@base .\n")); serd_free(out); @@ -531,19 +531,19 @@ test_writer(const char* const path) // Test writing empty node SerdNode nothing = serd_node_from_string(SERD_NOTHING, ""); - chunk.buf = NULL; - chunk.len = 0; - writer = serd_writer_new( - SERD_TURTLE, (SerdStyle)0, env, NULL, serd_chunk_sink, &chunk); + buffer.buf = NULL; + buffer.len = 0; + writer = serd_writer_new( + SERD_TURTLE, (SerdStyle)0, env, NULL, serd_buffer_sink, &buffer); assert(!serd_writer_write_statement( writer, 0, NULL, &s, &p, ¬hing, NULL, NULL)); assert( - !strncmp((const char*)chunk.buf, "<>\n\t ", 30)); + !strncmp((const char*)buffer.buf, "<>\n\t ", 30)); serd_writer_free(writer); - out = serd_chunk_sink_finish(&chunk); + out = serd_buffer_sink_finish(&buffer); assert(!strcmp((const char*)out, "<>\n\t .\n")); serd_free(out); -- cgit v1.2.1