summaryrefslogtreecommitdiff
path: root/src/or/geoip.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2011-03-10 01:47:00 +0100
committerSebastian Hahn <sebastian@torproject.org>2011-03-10 01:48:19 +0100
commit473ff2656355a796761e9eb5e15b30cd853c58b6 (patch)
tree9c794bb140312d5ff34af84a6c4fdac7eae2ace6 /src/or/geoip.c
parent6426cd14f37c2b24232f02d5c978313fab6a667f (diff)
downloadtor-473ff2656355a796761e9eb5e15b30cd853c58b6.tar.gz
tor-473ff2656355a796761e9eb5e15b30cd853c58b6.zip
Fix two compile warnings when using clang
Issue found by Steven Murdoch
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r--src/or/geoip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index e5694b9618..f3e0b72e66 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -278,6 +278,8 @@ geoip_is_loaded(void)
return geoip_countries != NULL && geoip_entries != NULL;
}
+#define MAX_LAST_SEEN_IN_MINUTES 0x3FFFFFFFu
+
/** Entry in a map from IP address to the last time we've seen an incoming
* connection from that IP address. Used by bridges only, to track which
* countries have them blocked. */
@@ -413,12 +415,13 @@ geoip_note_client_seen(geoip_client_action_t action,
lookup.ipaddr = addr;
lookup.action = (int)action;
ent = HT_FIND(clientmap, &client_history, &lookup);
+ tor_assert(now / 60 <= MAX_LAST_SEEN_IN_MINUTES);
if (ent) {
- ent->last_seen_in_minutes = now / 60;
+ ent->last_seen_in_minutes = (unsigned)(now/60);
} else {
ent = tor_malloc_zero(sizeof(clientmap_entry_t));
ent->ipaddr = addr;
- ent->last_seen_in_minutes = now / 60;
+ ent->last_seen_in_minutes = (unsigned)(now/60);
ent->action = (int)action;
HT_INSERT(clientmap, &client_history, ent);
}