[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Fix some clang warnings



commit 15ce5a3e5ab18f44172f1ada3fe1735f28a95c09
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu May 3 12:31:35 2018 -0400

    Fix some clang warnings
---
 src/or/circuitbuild.c | 18 ++++++++++--------
 src/or/circuitbuild.h |  2 +-
 src/or/main.c         |  2 +-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 0617c2477..7f4504f6b 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -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",
diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h
index f3a8bbfc9..725d872d0 100644
--- a/src/or/circuitbuild.h
+++ b/src/or/circuitbuild.h
@@ -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,
diff --git a/src/or/main.c b/src/or/main.c
index b6035fa76..b8827b947 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits