summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-28 03:13:05 +0000
committerDavid Robillard <d@drobilla.net>2011-03-28 03:13:05 +0000
commit7b067fc094b0495359557e6442636a38567e995c (patch)
treefb78b8bf472aa0196dd7f9e2ed7ac74d2e976df2 /src/util.c
parentdb78a2f56fc8bd3b188ea54e0461cb3108c2dedb (diff)
downloadlilv-7b067fc094b0495359557e6442636a38567e995c.tar.gz
lilv-7b067fc094b0495359557e6442636a38567e995c.tar.bz2
lilv-7b067fc094b0495359557e6442636a38567e995c.zip
Fix Windows build
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3129 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index ba2ca5d..d7ac0b7 100644
--- a/src/util.c
+++ b/src/util.c
@@ -59,13 +59,28 @@ slv2_strjoin(const char* first, ...)
return result;
}
+char*
+slv2_strdup(const char* str)
+{
+ const size_t len = strlen(str);
+ char* dup = malloc(len + 1);
+ memcpy(dup, str, len + 1);
+ return dup;
+}
+
const char*
slv2_uri_to_path(const char* uri)
{
- if (!strncmp(uri, "file://", (size_t)7))
+#ifdef __WIN32__
+ if (!strncmp(uri, "file:///", (size_t)8)) {
+ return (char*)(uri + 8);
+#else
+ if (!strncmp(uri, "file://", (size_t)7)) {
return (char*)(uri + 7);
- else
+#endif
+ } else {
return NULL;
+ }
}
/** Return the current LANG converted to Turtle (i.e. RFC3066) style.