aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-12-31 11:48:42 -0500
committerDavid Robillard <d@drobilla.net>2020-06-21 18:12:04 +0200
commitb8fdca565db6facfcaca2c35ad4fa9c51eeb299d (patch)
treeada203abc2b4a0f1276c70258fba1b7f3763f908 /src/uri.c
parentd68795cb7d79ed4b6b92386f548524ae518f41b9 (diff)
downloadserd-b8fdca565db6facfcaca2c35ad4fa9c51eeb299d.tar.gz
serd-b8fdca565db6facfcaca2c35ad4fa9c51eeb299d.tar.bz2
serd-b8fdca565db6facfcaca2c35ad4fa9c51eeb299d.zip
Fix various warnings and conversion issues
Diffstat (limited to 'src/uri.c')
-rw-r--r--src/uri.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/uri.c b/src/uri.c
index 566690b2..24ac5dcc 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -40,8 +40,9 @@ serd_file_uri_parse(const char* uri, char** hostname)
return NULL;
}
if (hostname) {
- *hostname = (char*)calloc((size_t)(path - auth + 1), 1);
- memcpy(*hostname, auth, (size_t)(path - auth));
+ const size_t len = (size_t)(path - auth);
+ *hostname = (char*)calloc(len + 1, 1);
+ memcpy(*hostname, auth, len);
}
}
}
@@ -58,7 +59,7 @@ serd_file_uri_parse(const char* uri, char** hostname)
++s;
} else if (is_hexdig(*(s + 1)) && is_hexdig(*(s + 2))) {
const char code[3] = {*(s + 1), *(s + 2), 0};
- const char c = (char)strtoul((const char*)code, NULL, 16);
+ const char c = (char)strtoul(code, NULL, 16);
serd_buffer_sink(&c, 1, 1, &buffer);
s += 2;
} else {