diff options
Diffstat (limited to 'src/uri.c')
-rw-r--r-- | src/uri.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -51,23 +51,24 @@ serd_parse_file_uri(const char* const uri, char** const hostname) for (const char* s = path; *s; ++s) { if (*s == '%') { if (*(s + 1) == '%') { - serd_buffer_sink("%", 1, 1, &buffer); + serd_buffer_write("%", 1, 1, &buffer); ++s; } else if (is_hexdig(*(s + 1)) && is_hexdig(*(s + 2))) { const uint8_t hi = hex_digit_value((const uint8_t)s[1]); const uint8_t lo = hex_digit_value((const uint8_t)s[2]); const char c = (char)((hi << 4U) | lo); - serd_buffer_sink(&c, 1, 1, &buffer); + serd_buffer_write(&c, 1, 1, &buffer); s += 2; } else { s += 2; // Junk escape, ignore } } else { - serd_buffer_sink(s, 1, 1, &buffer); + serd_buffer_write(s, 1, 1, &buffer); } } - return serd_buffer_sink_finish(&buffer); + serd_buffer_close(&buffer); + return (char*)buffer.buf; } /// RFC3986: scheme ::= ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) |