summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-07-14 14:15:09 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-07-14 14:15:09 +0200
commit4bf95d6fff7bc3727fa4d4b916b2c6e4fcf87a83 (patch)
treee580fd4b06d2bbfe805dd5876e22269293a26535
parenteccd95627503db5dc70507acc736949a25af0668 (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.c13
1 files 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();