From 1997ab63fb66a55341de0311e1b309419a32d724 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 31 Dec 2018 11:48:42 -0500 Subject: Fix various warnings and conversion issues --- src/uri.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/uri.c') diff --git a/src/uri.c b/src/uri.c index 7b4b89e4..41a2074c 100644 --- a/src/uri.c +++ b/src/uri.c @@ -41,8 +41,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); } } } @@ -59,7 +60,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 { -- cgit v1.2.1