summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2018-02-18 14:38:37 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2018-02-18 14:38:37 +0100
commit2e7f0da2975fed69c927c7641ba37d95ad0887e6 (patch)
tree1e7f74dd7a7391439339e28015caaf78568f883c /util.c
parentaa68fc5256ffd5d63b8032e1adee871e90b655f1 (diff)
util: improve a cast
Diffstat (limited to 'util.c')
-rw-r--r--util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util.c b/util.c
index 01237b0..1662f47 100644
--- a/util.c
+++ b/util.c
@@ -35,7 +35,7 @@ parseuri(const char *s, struct uri *u, int rel)
*p == '+' || *p == '-' || *p == '.'); p++)
;
if (!strncmp(p, "://", 3)) {
- if (p - s >= (ssize_t)sizeof(u->proto))
+ if ((size_t)(p - s) >= sizeof(u->proto))
return -1; /* protocol too long */
memcpy(u->proto, s, p - s);
u->proto[p - s] = '\0';
@@ -50,7 +50,7 @@ parseuri(const char *s, struct uri *u, int rel)
/* IPv6 address */
if (*p == '[') {
/* bracket not found or host too long */
- if (!(b = strchr(p, ']')) || b - p >= (ssize_t)sizeof(u->host))
+ if (!(b = strchr(p, ']')) || (size_t)(b - p) >= (ssize_t)sizeof(u->host))
return -1;
memcpy(u->host, p + 1, b - p - 1);
u->host[b - p - 1] = '\0';