aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-03-15 23:21:34 -0400
committerDavid Robillard <d@drobilla.net>2018-11-25 09:21:03 +0100
commitf046eb982627f344fc0eeff6be82028318862e67 (patch)
treea8216165d6e74ff5650e4cdd5a2a44b05b611f63 /src/uri.c
parentfc6ef04d8b94909523708c1bdbb9ea8f42063662 (diff)
downloadserd-f046eb982627f344fc0eeff6be82028318862e67.tar.gz
serd-f046eb982627f344fc0eeff6be82028318862e67.tar.bz2
serd-f046eb982627f344fc0eeff6be82028318862e67.zip
Use SerdBuffer for mutable buffers
This avoids const violations from abusing SerdChunk as a mutable buffer for string sinks.
Diffstat (limited to 'src/uri.c')
-rw-r--r--src/uri.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/uri.c b/src/uri.c
index 70b13717..f4f8580e 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -70,25 +70,25 @@ serd_file_uri_parse(const uint8_t* uri, uint8_t** hostname)
++path;
}
- SerdChunk chunk = { NULL, 0 };
+ SerdBuffer buffer = { NULL, 0 };
for (const uint8_t* s = path; *s; ++s) {
if (*s == '%') {
if (*(s + 1) == '%') {
- serd_chunk_sink("%", 1, &chunk);
+ serd_buffer_sink("%", 1, &buffer);
++s;
} else if (is_hexdig(*(s + 1)) && is_hexdig(*(s + 2))) {
const uint8_t code[3] = {*(s + 1), *(s + 2), 0};
const uint8_t c = (uint8_t)strtoul((const char*)code, NULL, 16);
- serd_chunk_sink(&c, 1, &chunk);
+ serd_buffer_sink(&c, 1, &buffer);
s += 2;
} else {
s += 2; // Junk escape, ignore
}
} else {
- serd_chunk_sink(s, 1, &chunk);
+ serd_buffer_sink(s, 1, &buffer);
}
}
- return serd_chunk_sink_finish(&chunk);
+ return serd_buffer_sink_finish(&buffer);
}
bool