From 4bf95d6fff7bc3727fa4d4b916b2c6e4fcf87a83 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 14 Jul 2013 14:15:09 +0200 Subject: geoip: Fix sign compare warnings array_size() returns size_t, thus make iterator variables comparing against it size_t too to avoid a warning regarding comparison of signed/unsigned. Also cast some ssize_t variables passed to min() for the same reason. Signed-off-by: Tobias Klauser --- geoip.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/geoip.c b/geoip.c index d027e14..d79236c 100644 --- a/geoip.c +++ b/geoip.c @@ -198,15 +198,15 @@ again: raw[sizeof(raw) - 1] = 0; for (i = 0; i < ret; i++) { - if (!strncmp(raw + i, "Content-Length: ", min(ret - i, lenl))) { + if (!strncmp(raw + i, "Content-Length: ", min((size_t)(ret - i), lenl))) { ptr = raw + i + lenl; rtotlen = strtoul(ptr, NULL, 10); } - if (!strncmp(raw + i, "HTTP/1.1 200 OK", min(ret - i, lent))) + if (!strncmp(raw + i, "HTTP/1.1 200 OK", min((size_t)(ret - i), lent))) good = 1; - if (!strncmp(raw + i, "\r\n\r\n", min(ret - i, lenc))) { + if (!strncmp(raw + i, "\r\n\r\n", min((size_t)(ret - i), lenc))) { ptr = raw + i + lenc; len = ret - i - lenc; found = 1; @@ -522,7 +522,7 @@ static void destroy_geoip_asname(void) static void init_mirrors(void) { - int i = 0; + size_t i = 0; FILE *fp; char buff[256]; @@ -550,7 +550,7 @@ static void init_mirrors(void) static void destroy_mirrors(void) { - int i; + size_t i; for (i = 0; i < array_size(servers); ++i) free(servers[i]); @@ -565,7 +565,8 @@ void init_geoip(int enforce) void update_geoip(void) { - int i, j, ret, good = 0; + size_t i, j; + int ret, good = 0; init_mirrors(); -- cgit v1.2.3-54-g00ecf