aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--COPYING2
-rw-r--r--NEWS5
-rw-r--r--src/env.c6
-rw-r--r--src/node.c12
-rw-r--r--src/string.c15
-rw-r--r--wscript2
6 files changed, 22 insertions, 20 deletions
diff --git a/COPYING b/COPYING
index 7ee8c213..7121a876 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright 2011-2015 David Robillard <http://drobilla.net>
+Copyright 2011-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/NEWS b/NEWS
index d334bc48..e469e9f6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,13 @@
-serd (0.22.3) unstable;
+serd (0.22.4) unstable;
+ * Fix construction and comparison of URIs with UTF-8 characters
* Report I/O errors with message and return appropriate status code
* Fix potential out of bounds read
* Fix unaligned memory access, undefined behaviour which breaks on ARM
* Fix documentation generation
* Update serdi man page
- -- David Robillard <d@drobilla.net> Sun, 29 May 2016 18:33:41 -0400
+ -- David Robillard <d@drobilla.net> Sat, 09 Jul 2016 11:27:45 -0400
serd (0.22.0) stable;
diff --git a/src/env.c b/src/env.c
index 514e487d..a753c140 100644
--- a/src/env.c
+++ b/src/env.c
@@ -1,5 +1,5 @@
/*
- Copyright 2011-2014 David Robillard <http://drobilla.net>
+ Copyright 2011-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -243,9 +243,9 @@ serd_env_expand_node(const SerdEnv* env,
if (serd_env_expand(env, node, &prefix, &suffix)) {
return SERD_NODE_NULL;
}
- const size_t len = prefix.len + suffix.len; // FIXME: UTF-8?
+ const size_t len = prefix.len + suffix.len;
uint8_t* buf = (uint8_t*)malloc(len + 1);
- SerdNode ret = { buf, len, len, 0, SERD_URI };
+ SerdNode ret = { buf, len, serd_strlen(buf, NULL, NULL), 0, SERD_URI };
snprintf((char*)buf, ret.n_bytes + 1, "%s%s", prefix.buf, suffix.buf);
return ret;
}
diff --git a/src/node.c b/src/node.c
index db99e89e..dc50cd7a 100644
--- a/src/node.c
+++ b/src/node.c
@@ -1,5 +1,5 @@
/*
- Copyright 2011-2015 David Robillard <http://drobilla.net>
+ Copyright 2011-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -197,17 +197,15 @@ serd_node_new_uri(const SerdURI* uri, const SerdURI* base, SerdURI* out)
serd_uri_resolve(uri, base, &abs_uri);
}
- const size_t len = serd_uri_string_length(&abs_uri);
- uint8_t* buf = (uint8_t*)malloc(len + 1);
-
- SerdNode node = { buf, len, len, 0, SERD_URI }; // FIXME: UTF-8
-
+ const size_t len = serd_uri_string_length(&abs_uri);
+ uint8_t* buf = (uint8_t*)malloc(len + 1);
+ SerdNode node = { buf, 0, 0, 0, SERD_URI };
uint8_t* ptr = buf;
const size_t actual_len = serd_uri_serialise(&abs_uri, string_sink, &ptr);
buf[actual_len] = '\0';
node.n_bytes = actual_len;
- node.n_chars = actual_len;
+ node.n_chars = serd_strlen(buf, NULL, NULL);
if (out) {
serd_uri_parse(buf, out); // TODO: cleverly avoid double parse
diff --git a/src/string.c b/src/string.c
index a1a1dff1..1e653795 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1,5 +1,5 @@
/*
- Copyright 2011-2012 David Robillard <http://drobilla.net>
+ Copyright 2011-2016 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -40,25 +40,28 @@ SERD_API
size_t
serd_strlen(const uint8_t* str, size_t* n_bytes, SerdNodeFlags* flags)
{
- size_t n_chars = 0;
- size_t i = 0;
- *flags = 0;
+ size_t n_chars = 0;
+ size_t i = 0;
+ SerdNodeFlags f = 0;
for (; str[i]; ++i) {
if ((str[i] & 0xC0) != 0x80) {
// Does not start with `10', start of a new character
++n_chars;
switch (str[i]) {
case '\r': case '\n':
- *flags |= SERD_HAS_NEWLINE;
+ f |= SERD_HAS_NEWLINE;
break;
case '"':
- *flags |= SERD_HAS_QUOTE;
+ f |= SERD_HAS_QUOTE;
}
}
}
if (n_bytes) {
*n_bytes = i;
}
+ if (flags) {
+ *flags = f;
+ }
return n_chars;
}
diff --git a/wscript b/wscript
index 59416f9c..122a6f04 100644
--- a/wscript
+++ b/wscript
@@ -11,7 +11,7 @@ import waflib.extras.autowaf as autowaf
# major increment <=> incompatible changes
# minor increment <=> compatible changes (additions)
# micro increment <=> no interface changes
-SERD_VERSION = '0.22.3'
+SERD_VERSION = '0.22.4'
SERD_MAJOR_VERSION = '0'
# Mandatory waf variables