summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/confparse.c2
-rw-r--r--src/or/cpuworker.c2
-rw-r--r--src/or/hibernate.c3
-rw-r--r--src/or/main.c8
-rw-r--r--src/or/rephist.c4
-rw-r--r--src/or/status.c8
6 files changed, 13 insertions, 14 deletions
diff --git a/src/or/confparse.c b/src/or/confparse.c
index 8db6d60807..08f5fd0487 100644
--- a/src/or/confparse.c
+++ b/src/or/confparse.c
@@ -1117,7 +1117,7 @@ config_parse_units(const char *val, struct unit_table_t *u, int *ok)
if (!cp) {
*ok = 1;
- v = use_float ? DBL_TO_U64(d) : v;
+ v = use_float ? ((uint64_t)d) : v;
goto done;
}
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 6750790205..b37dfd1684 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -283,7 +283,7 @@ get_overhead_for_onionskins(uint32_t *usec_out, double *frac_out,
onionskins_usec_internal[onionskin_type];
*usec_out = (uint32_t)(overhead / onionskins_n_processed[onionskin_type]);
- *frac_out = U64_TO_DBL(overhead) / onionskins_usec_internal[onionskin_type];
+ *frac_out = ((double)overhead) / onionskins_usec_internal[onionskin_type];
return 0;
}
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index c6190bc89c..30a5edc1f2 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -799,7 +799,7 @@ hibernate_soft_limit_reached(void)
* - We have used up 95% of our bytes.
* - We have less than 500MB of bytes left.
*/
- uint64_t soft_limit = DBL_TO_U64(U64_TO_DBL(acct_max) * SOFT_LIM_PCT);
+ uint64_t soft_limit = (uint64_t) (acct_max * SOFT_LIM_PCT);
if (acct_max > SOFT_LIM_BYTES && acct_max - SOFT_LIM_BYTES > soft_limit) {
soft_limit = acct_max - SOFT_LIM_BYTES;
}
@@ -1227,4 +1227,3 @@ hibernate_set_state_for_testing_(hibernate_state_t newstate)
hibernate_state = newstate;
}
#endif /* defined(TOR_UNIT_TESTS) */
-
diff --git a/src/or/main.c b/src/or/main.c
index c2fa416d6b..f07d9da8b0 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -3279,12 +3279,12 @@ dumpstats(int severity)
(stats_n_destroy_cells_processed));
if (stats_n_data_cells_packaged)
tor_log(severity,LD_NET,"Average packaged cell fullness: %2.3f%%",
- 100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
- U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
+ 100*(((double)stats_n_data_bytes_packaged) /
+ ((double)stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
if (stats_n_data_cells_received)
tor_log(severity,LD_NET,"Average delivered cell fullness: %2.3f%%",
- 100*(U64_TO_DBL(stats_n_data_bytes_received) /
- U64_TO_DBL(stats_n_data_cells_received*RELAY_PAYLOAD_SIZE)) );
+ 100*(((double)stats_n_data_bytes_received) /
+ ((double)stats_n_data_cells_received*RELAY_PAYLOAD_SIZE)) );
cpuworker_log_onionskin_overhead(severity, ONION_HANDSHAKE_TYPE_TAP, "TAP");
cpuworker_log_onionskin_overhead(severity, ONION_HANDSHAKE_TYPE_NTOR,"ntor");
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 12b0225aab..34c06760bc 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1218,9 +1218,9 @@ rep_hist_bandwidth_assess(void)
r = find_largest_max(read_array);
w = find_largest_max(write_array);
if (r>w)
- return (int)(U64_TO_DBL(w)/NUM_SECS_ROLLING_MEASURE);
+ return (int)(((double)w)/NUM_SECS_ROLLING_MEASURE);
else
- return (int)(U64_TO_DBL(r)/NUM_SECS_ROLLING_MEASURE);
+ return (int)(((double)r)/NUM_SECS_ROLLING_MEASURE);
}
/** Print the bandwidth history of b (either [dir-]read_array or
diff --git a/src/or/status.c b/src/or/status.c
index 5c0a768ace..4538e22a56 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -79,10 +79,10 @@ bytes_to_usage(uint64_t bytes)
if (bytes < (1<<20)) { /* Less than a megabyte. */
tor_asprintf(&bw_string, "%"PRIu64" kB", (bytes>>10));
} else if (bytes < (1<<30)) { /* Megabytes. Let's add some precision. */
- double bw = U64_TO_DBL(bytes);
+ double bw = ((double)bytes);
tor_asprintf(&bw_string, "%.2f MB", bw/(1<<20));
} else { /* Gigabytes. */
- double bw = U64_TO_DBL(bytes);
+ double bw = ((double)bytes);
tor_asprintf(&bw_string, "%.2f GB", bw/(1<<30));
}
@@ -150,8 +150,8 @@ log_heartbeat(time_t now)
double fullness_pct = 100;
if (stats_n_data_cells_packaged && !hibernating) {
fullness_pct =
- 100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
- U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE));
+ 100*(((double)stats_n_data_bytes_packaged) /
+ ((double)stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE));
}
const double overhead_pct = ( r - 1.0 ) * 100.0;