diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2013-07-14 14:15:09 +0200 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2013-07-14 14:15:09 +0200 |
commit | 4bf95d6fff7bc3727fa4d4b916b2c6e4fcf87a83 (patch) | |
tree | e580fd4b06d2bbfe805dd5876e22269293a26535 | |
parent | eccd95627503db5dc70507acc736949a25af0668 (diff) |
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 <tklauser@distanz.ch>
-rw-r--r-- | geoip.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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(); |