summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-07-25 22:56:34 +0000
committerNick Mathewson <nickm@torproject.org>2007-07-25 22:56:34 +0000
commit83fa8436636892758020c109258a79d862e2728b (patch)
treed45fc4782a5a6044eb00f351ce145628a0530655 /src
parentb764e8ee9e3ea392ac34f8195b1c9c4933f242e2 (diff)
downloadtor-83fa8436636892758020c109258a79d862e2728b.tar.gz
tor-83fa8436636892758020c109258a79d862e2728b.zip
r13900@catbus: nickm | 2007-07-25 16:16:30 -0400
Better fix for GCC 4.2 warning on routerlist.c svn:r10925
Diffstat (limited to 'src')
-rw-r--r--src/or/routerlist.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index e362cfe0d1..352c144e5a 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1165,7 +1165,7 @@ router_get_advertised_bandwidth(routerinfo_t *router)
static void *
smartlist_choose_by_bandwidth(smartlist_t *sl, int for_exit, int statuses)
{
- int i;
+ unsigned int i;
routerinfo_t *router;
routerstatus_t *status;
int32_t *bandwidths;
@@ -1182,7 +1182,7 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, int for_exit, int statuses)
bandwidths = tor_malloc(sizeof(int32_t)*smartlist_len(sl));
/* Iterate over all the routerinfo_t or routerstatus_t, and */
- for (i = 0; i < smartlist_len(sl); ++i) {
+ for (i = 0; i < (unsigned)smartlist_len(sl); ++i) {
/* first, learn what bandwidth we think i has */
int is_known = 1;
int32_t flags = 0;
@@ -1232,7 +1232,7 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, int for_exit, int statuses)
avg_fast = 40000;
avg_slow = 20000;
}
- for (i=0; i<smartlist_len(sl); ++i) {
+ for (i=0; i<(unsigned)smartlist_len(sl); ++i) {
int32_t bw = bandwidths[i];
if (bw>=0)
continue;
@@ -1283,7 +1283,7 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, int for_exit, int statuses)
/* Last, count through sl until we get to the element we picked */
tmp = 0;
- for (i=0; i < smartlist_len(sl); i++) {
+ for (i=0; i < (unsigned)smartlist_len(sl); i++) {
if (statuses) {
status = smartlist_get(sl, i);
is_exit = status->is_exit;
@@ -1298,7 +1298,7 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, int for_exit, int statuses)
if (tmp >= rand_bw)
break;
}
- if (i == smartlist_len(sl)) {
+ if (i == (unsigned)smartlist_len(sl)) {
/* This is possible due to round-off error. */
--i;
log_warn(LD_BUG, "Round-off error in computing bandwidth had an effect on "