Fix some clang warnings

This commit is contained in:
Nick Mathewson 2018-05-03 12:31:35 -04:00
parent c9f07f36bf
commit 15ce5a3e5a
3 changed files with 12 additions and 10 deletions

View File

@ -1138,22 +1138,24 @@ circuit_send_intermediate_onion_skin(origin_circuit_t *circ,
* something has also gone wrong with our network: notify the user, and
* abandon all not-yet-used circuits. */
void
circuit_note_clock_jumped(int seconds_elapsed, bool was_idle)
circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle)
{
int severity = server_mode(get_options()) ? LOG_WARN : LOG_NOTICE;
if (was_idle) {
tor_log(severity, LD_GENERAL, "Tor has been idle for %d seconds; "
"assuming established circuits no longer work.",
seconds_elapsed);
tor_log(severity, LD_GENERAL, "Tor has been idle for "I64_FORMAT
" seconds; assuming established circuits no longer work.",
I64_PRINTF_ARG(seconds_elapsed));
} else {
tor_log(severity, LD_GENERAL,
"Your system clock just jumped %d seconds %s; "
"Your system clock just jumped "I64_FORMAT" seconds %s; "
"assuming established circuits no longer work.",
seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed,
I64_PRINTF_ARG(
seconds_elapsed >=0 ? seconds_elapsed : -seconds_elapsed),
seconds_elapsed >=0 ? "forward" : "backward");
}
control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME=%d IDLE=%d",
seconds_elapsed, was_idle?1:0);
control_event_general_status(LOG_WARN, "CLOCK_JUMPED TIME="I64_FORMAT
" IDLE=%d",
I64_PRINTF_ARG(seconds_elapsed), was_idle?1:0);
/* so we log when it works again */
note_that_we_maybe_cant_complete_circuits();
control_event_client_status(severity, "CIRCUIT_NOT_ESTABLISHED REASON=%s",

View File

@ -29,7 +29,7 @@ void circuit_n_chan_done(channel_t *chan, int status,
int inform_testing_reachability(void);
int circuit_timeout_want_to_count_circ(const origin_circuit_t *circ);
int circuit_send_next_onion_skin(origin_circuit_t *circ);
void circuit_note_clock_jumped(int seconds_elapsed, bool was_idle);
void circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle);
int circuit_extend(cell_t *cell, circuit_t *circ);
int circuit_init_cpath_crypto(crypt_path_t *cpath,
const char *key_data, size_t key_data_len,

View File

@ -2538,7 +2538,7 @@ update_current_time(time_t now)
monotime_coarse_diff_msec32(&last_updated,
&current_second_last_changed);
const int monotime_sec_passed = monotime_msec_passed / 1000;
const int discrepency = monotime_sec_passed - seconds_elapsed;
const int discrepency = monotime_sec_passed - (int)seconds_elapsed;
/* If the monotonic clock deviates from time(NULL), we have a couple of
* possibilities. On some systems, this means we have been suspended or
* sleeping. Everywhere, it can mean that the wall-clock time has