diff options
author | David Robillard <d@drobilla.net> | 2011-02-16 17:02:23 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-16 17:02:23 +0000 |
commit | ebbaf807a95ad9fb80e0bfcfdab629a257c5836d (patch) | |
tree | bc6eaa50241bc101ab173b4fc3710d921c29e4af /src/node.c | |
parent | b492b51733adc575c4dbb862d270d71671b39fee (diff) | |
download | serd-ebbaf807a95ad9fb80e0bfcfdab629a257c5836d.tar.gz serd-ebbaf807a95ad9fb80e0bfcfdab629a257c5836d.tar.bz2 serd-ebbaf807a95ad9fb80e0bfcfdab629a257c5836d.zip |
Fix serd_node_new_uri_from_string with empty string.
git-svn-id: http://svn.drobilla.net/serd/trunk@100 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/node.c')
-rw-r--r-- | src/node.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -85,10 +85,13 @@ serd_node_new_uri_from_string(const uint8_t* str, const SerdURI* base, SerdURI* out) { - // Parse (possibly relative) URI - SerdURI uri; - if (serd_uri_parse(str, &uri)) { - return serd_node_new_uri(&uri, base, out); + if (str[0] == '\0') { + return serd_node_new_uri(base, NULL, out); // Empty URI => Base URI + } else { + SerdURI uri; + if (serd_uri_parse(str, &uri)) { + return serd_node_new_uri(&uri, base, out); // Resolve/Serialise + } } return SERD_NODE_NULL; } @@ -127,5 +130,5 @@ SERD_API void serd_node_free(SerdNode* node) { - free((uint8_t*)node->buf); // FIXME: ick, const cast + free((uint8_t*)node->buf); } |