aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-16 17:02:23 +0000
committerDavid Robillard <d@drobilla.net>2011-02-16 17:02:23 +0000
commitebbaf807a95ad9fb80e0bfcfdab629a257c5836d (patch)
treebc6eaa50241bc101ab173b4fc3710d921c29e4af
parentb492b51733adc575c4dbb862d270d71671b39fee (diff)
downloadserd-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
-rw-r--r--src/node.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/node.c b/src/node.c
index 1cf24891..7bf915e5 100644
--- a/src/node.c
+++ b/src/node.c
@@ -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);
}