aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-03-01 19:15:24 -0500
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:06 -0500
commit15485f61df8cbd922907db39fcc864abb002eea3 (patch)
tree3ea4979ab93405925589d18414a5004e8b46286f /src/uri.c
parent468f7dc4294905d19f55c58c47ba91cd23bf357b (diff)
downloadserd-15485f61df8cbd922907db39fcc864abb002eea3.tar.gz
serd-15485f61df8cbd922907db39fcc864abb002eea3.tar.bz2
serd-15485f61df8cbd922907db39fcc864abb002eea3.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 5b1ed598..f4d602fb 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -43,8 +43,9 @@ serd_parse_file_uri(const char* uri, char** hostname)
}
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);
}
}
}
@@ -61,7 +62,7 @@ serd_parse_file_uri(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 {