summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-01-11 03:57:01 +0000
committerNick Mathewson <nickm@torproject.org>2006-01-11 03:57:01 +0000
commit6a9ca9e790d2960f9ee3610b2b0343df9930291e (patch)
tree7d80e074806940feb3c84d425ec7c21ed6ce0f05
parentd1baa0c4a62aec739aee928375549de3deb8d19e (diff)
downloadtor-6a9ca9e790d2960f9ee3610b2b0343df9930291e.tar.gz
tor-6a9ca9e790d2960f9ee3610b2b0343df9930291e.zip
Convert some more ints to long longs in rephist.c, as suggested by windows compiler.
svn:r5789
-rw-r--r--src/or/rephist.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index dd68df823c..fb6ac405b2 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -394,12 +394,12 @@ rep_history_clean(time_t before)
typedef struct bw_array_t {
/** Observation array: Total number of bytes transferred in each of the last
* NUM_SECS_ROLLING_MEASURE seconds. This is used as a circular array. */
- int obs[NUM_SECS_ROLLING_MEASURE];
+ uint64_t obs[NUM_SECS_ROLLING_MEASURE];
int cur_obs_idx; /**< Current position in obs. */
time_t cur_obs_time; /**< Time represented in obs[cur_obs_idx] */
- int total_obs; /**< Total for all members of obs except obs[cur_obs_idx] */
- int max_total; /**< Largest value that total_obs has taken on in the current
- * period. */
+ uint64_t total_obs; /**< Total for all members of obs except obs[cur_obs_idx] */
+ uint64_t max_total; /**< Largest value that total_obs has taken on in the current
+ * period. */
uint64_t total_in_period; /**< Total bytes transferred in the current
* period. */
@@ -413,7 +413,7 @@ typedef struct bw_array_t {
/** Circular array of the maximum
* bandwidth-per-NUM_SECS_ROLLING_MEASURE usage for the last
* NUM_TOTALS periods */
- int maxima[NUM_TOTALS];
+ uint64_t maxima[NUM_TOTALS];
/** Circular array of the total bandwidth usage for the last NUM_TOTALS
* periods */
uint64_t totals[NUM_TOTALS];
@@ -446,7 +446,7 @@ static INLINE void
advance_obs(bw_array_t *b)
{
int nextidx;
- int total;
+ uint64_t total;
/* Calculate the total bandwidth for the last NUM_SECS_ROLLING_MEASURE
* seconds; adjust max_total as needed.*/
@@ -546,10 +546,11 @@ rep_hist_note_bytes_read(int num_bytes, time_t when)
* most bandwidth used in any NUM_SECS_ROLLING_MEASURE period for the last
* NUM_SECS_BW_SUM_IS_VALID seconds.)
*/
-static int
+static uint64_t
find_largest_max(bw_array_t *b)
{
- int i,max;
+ int i;
+ uint64_t max;
max=0;
for (i=0; i<NUM_TOTALS; ++i) {
if (b->maxima[i]>max)
@@ -568,7 +569,7 @@ find_largest_max(bw_array_t *b)
int
rep_hist_bandwidth_assess(void)
{
- int w,r;
+ uint64_t w,r;
r = find_largest_max(read_array);
w = find_largest_max(write_array);
if (r>w)