summaryrefslogtreecommitdiff
path: root/src/or/geoip.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-02-22 19:09:45 +0000
committerNick Mathewson <nickm@torproject.org>2008-02-22 19:09:45 +0000
commite7db789e82a7a2edc5c7e8230265f8ec83021f69 (patch)
treec8af0a1fe11383d565d916634a7c0d4c963ce4ec /src/or/geoip.c
parenta20eda5669cc5ce8b8c02d16ea80f642b7de64f9 (diff)
downloadtor-e7db789e82a7a2edc5c7e8230265f8ec83021f69.tar.gz
tor-e7db789e82a7a2edc5c7e8230265f8ec83021f69.zip
r14399@tombo: nickm | 2008-02-22 14:09:38 -0500
More 64-to-32 fixes. Partial backport candidate. still not done. svn:r13680
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r--src/or/geoip.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 49f1746b52..f81c18c85f 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -20,7 +20,7 @@ static void clear_geoip_db(void);
typedef struct geoip_entry_t {
uint32_t ip_low; /**< The lowest IP in the range, in host order */
uint32_t ip_high; /**< The highest IP in the range, in host order */
- int country; /**< An index into geoip_countries */
+ intptr_t country; /**< An index into geoip_countries */
} geoip_entry_t;
/** A list of lowercased two-letter country codes. */
@@ -38,7 +38,7 @@ static smartlist_t *geoip_entries = NULL;
static void
geoip_add_entry(uint32_t low, uint32_t high, const char *country)
{
- uintptr_t idx;
+ intptr_t idx;
geoip_entry_t *ent;
void *_idxplus1;
@@ -143,7 +143,7 @@ geoip_load_file(const char *filename)
log_info(LD_GENERAL, "Parsing GEOIP file.");
while (!feof(f)) {
char buf[512];
- if (fgets(buf, sizeof(buf), f) == NULL)
+ if (fgets(buf, (int)sizeof(buf), f) == NULL)
break;
/* FFFF track full country name. */
geoip_parse_entry(buf);
@@ -167,14 +167,14 @@ geoip_get_country_by_ip(uint32_t ipaddr)
if (!geoip_entries)
return -1;
ent = smartlist_bsearch(geoip_entries, &ipaddr, _geoip_compare_key_to_entry);
- return ent ? ent->country : -1;
+ return ent ? (int)ent->country : -1;
}
/** Return the number of countries recognized by the GeoIP database. */
int
geoip_get_n_countries(void)
{
- return smartlist_len(geoip_countries);
+ return (int) smartlist_len(geoip_countries);
}
/** Return the two-letter country code associated with the number <b>num</b>,