aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/writer.c b/src/writer.c
index e65255f7..8331f5ee 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -370,9 +370,11 @@ write_text(SerdWriter* writer, TextContext ctx,
}
static size_t
-uri_sink(const void* buf, size_t len, void* stream)
+uri_sink(const void* buf, size_t size, size_t nmemb, void* stream)
{
- return write_uri((SerdWriter*)stream, (const char*)buf, len);
+ (void)size;
+ assert(size == 1);
+ return write_uri((SerdWriter*)stream, (const char*)buf, nmemb);
}
static void
@@ -870,7 +872,7 @@ serd_writer_new(SerdSyntax syntax,
SerdStyle style,
SerdEnv* env,
const SerdURI* base_uri,
- SerdSink ssink,
+ SerdWriteFunc ssink,
void* stream)
{
const WriteContext context = WRITE_CONTEXT_NULL;
@@ -992,24 +994,21 @@ serd_writer_get_env(SerdWriter* writer)
}
size_t
-serd_file_sink(const void* buf, size_t len, void* stream)
+serd_buffer_sink(const void* buf, size_t size, size_t nmemb, void* stream)
{
- return fwrite(buf, 1, len, (FILE*)stream);
-}
+ assert(size == 1);
+ (void)size;
-size_t
-serd_buffer_sink(const void* buf, size_t len, void* stream)
-{
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;
+ buffer->buf = (char*)realloc(buffer->buf, buffer->len + nmemb);
+ memcpy((uint8_t*)buffer->buf + buffer->len, buf, nmemb);
+ buffer->len += nmemb;
+ return nmemb;
}
char*
serd_buffer_sink_finish(SerdBuffer* stream)
{
- serd_buffer_sink("", 1, stream);
+ serd_buffer_sink("", 1, 1, stream);
return (char*)stream->buf;
}