aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-07-17 00:39:05 +0000
committerNick Mathewson <nickm@torproject.org>2006-07-17 00:39:05 +0000
commite572d5990c4ed5100338a4e1ad4cae6a55329b4f (patch)
tree18ec12edf7054392a0203a327a5b4bd11f9026b2 /src/or
parent169d6c4aca43ea574762f42542a9db4745396ff8 (diff)
downloadtor-e572d5990c4ed5100338a4e1ad4cae6a55329b4f.tar
tor-e572d5990c4ed5100338a4e1ad4cae6a55329b4f.tar.gz
MSVC6 is apparently terrified of unnatural cross-breeding between uint64_t and double, and needs more persuasion than usual to cast one to the other. Issue identified by Frediano Ziglio; patch revised for minimal impact on non-MSVC6 compilers.
svn:r6768
Diffstat (limited to 'src/or')
-rw-r--r--src/or/hibernate.c2
-rw-r--r--src/or/main.c4
-rw-r--r--src/or/rephist.c6
3 files changed, 5 insertions, 7 deletions
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index d4e6ceb07..b41bf44ed 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -683,7 +683,7 @@ hibernate_hard_limit_reached(void)
static int
hibernate_soft_limit_reached(void)
{
- uint64_t soft_limit = (uint64_t) ((get_options()->AccountingMax) * .95);
+ uint64_t soft_limit = DBL_TO_U64((get_options()->AccountingMax) * .95);
if (!soft_limit)
return 0;
return n_bytes_read_in_interval >= soft_limit
diff --git a/src/or/main.c b/src/or/main.c
index bb562a572..7b2364a4f 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1359,11 +1359,11 @@ dumpstats(int severity)
U64_PRINTF_ARG(stats_n_destroy_cells_processed));
if (stats_n_data_cells_packaged)
log(severity,LD_NET,"Average packaged cell fullness: %2.3f%%",
- 100*(((double)stats_n_data_bytes_packaged) /
+ 100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
if (stats_n_data_cells_received)
log(severity,LD_NET,"Average delivered cell fullness: %2.3f%%",
- 100*(((double)stats_n_data_bytes_received) /
+ 100*(U64_TO_DBL(stats_n_data_bytes_received) /
(stats_n_data_cells_received*RELAY_PAYLOAD_SIZE)) );
if (now - time_of_process_start >= 0)
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 2459d46b7..3d391ad94 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -577,11 +577,9 @@ rep_hist_bandwidth_assess(void)
r = find_largest_max(read_array);
w = find_largest_max(write_array);
if (r>w)
- return (int)(w/(double)NUM_SECS_ROLLING_MEASURE);
+ return (int)(U64_TO_DBL(w)/NUM_SECS_ROLLING_MEASURE);
else
- return (int)(r/(double)NUM_SECS_ROLLING_MEASURE);
-
- return 0;
+ return (int)(U64_TO_DBL(r)/NUM_SECS_ROLLING_MEASURE);
}
/**