[tor-commits] [tor/master] Fix i386 conversion warnings

nickm at torproject.org nickm at torproject.org
Fri Jul 1 19:53:10 UTC 2016


commit 1597c423844de4da82cde58c9162d05ff5b28b40
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jul 1 15:52:57 2016 -0400

    Fix i386 conversion warnings
---
 src/or/shared_random.c        | 10 ++++++----
 src/test/test_shared_random.c | 12 ++++++------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/or/shared_random.c b/src/or/shared_random.c
index 7a0273d..a7a2238 100644
--- a/src/or/shared_random.c
+++ b/src/or/shared_random.c
@@ -254,8 +254,9 @@ commit_decode(const char *encoded, sr_commit_t *commit)
 
   if (decoded_len != SR_COMMIT_LEN) {
     log_warn(LD_BUG, "SR: Commit from authority %s decoded length doesn't "
-                     "match the expected length (%d vs %lu).",
-             sr_commit_get_rsa_fpr(commit), decoded_len, SR_COMMIT_LEN);
+                     "match the expected length (%d vs %u).",
+             sr_commit_get_rsa_fpr(commit), decoded_len,
+             (unsigned)SR_COMMIT_LEN);
     goto error;
   }
 
@@ -307,8 +308,9 @@ reveal_decode(const char *encoded, sr_commit_t *commit)
 
   if (decoded_len != SR_REVEAL_LEN) {
     log_warn(LD_BUG, "SR: Reveal from authority %s decoded length is "
-                     "doesn't match the expected length (%d vs %lu)",
-             sr_commit_get_rsa_fpr(commit), decoded_len, SR_REVEAL_LEN);
+                     "doesn't match the expected length (%d vs %u)",
+             sr_commit_get_rsa_fpr(commit), decoded_len,
+             (unsigned)SR_REVEAL_LEN);
     goto error;
   }
 
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index 141c12b..e5a7d21 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -302,7 +302,7 @@ test_sr_commit(void *arg)
     tt_assert(!tor_mem_is_zero((char *) our_commit->random_number,
                                sizeof(our_commit->random_number)));
     /* Commit and reveal timestamp should be the same. */
-    tt_int_op(our_commit->commit_ts, ==, our_commit->reveal_ts);
+    tt_u64_op(our_commit->commit_ts, ==, our_commit->reveal_ts);
     /* We should have a hashed reveal. */
     tt_assert(!tor_mem_is_zero(our_commit->hashed_reveal,
                                sizeof(our_commit->hashed_reveal)));
@@ -404,14 +404,14 @@ test_encoding(void *arg)
   {
     /* Test the reveal encoded value. */
     tt_int_op(0, ==, reveal_decode(encoded_reveal, &parsed_commit));
-    tt_uint_op(ts, ==, parsed_commit.reveal_ts);
+    tt_u64_op(ts, ==, parsed_commit.reveal_ts);
     tt_mem_op(hashed_rand, OP_EQ, parsed_commit.random_number,
               sizeof(hashed_rand));
 
     /* Test the commit encoded value. */
     memset(&parsed_commit, 0, sizeof(parsed_commit));
     tt_int_op(0, ==, commit_decode(encoded_commit, &parsed_commit));
-    tt_uint_op(ts, ==, parsed_commit.commit_ts);
+    tt_u64_op(ts, ==, parsed_commit.commit_ts);
     tt_mem_op(encoded_commit, OP_EQ, parsed_commit.encoded_commit,
               sizeof(parsed_commit.encoded_commit));
     tt_mem_op(hashed_reveal, OP_EQ, parsed_commit.hashed_reveal,
@@ -803,7 +803,7 @@ test_sr_compute_srv(void *arg)
   /* Check the result against the test vector */
   current_srv = sr_state_get_current_srv();
   tt_assert(current_srv);
-  tt_int_op(current_srv->num_reveals, ==, 3);
+  tt_u64_op(current_srv->num_reveals, ==, 3);
   tt_str_op(hex_str((char*)current_srv->value, 32),
             ==,
             SRV_TEST_VECTOR);
@@ -895,7 +895,7 @@ test_sr_get_majority_srv_from_votes(void *arg)
   set_num_srv_agreements(7);
   chosen_srv = get_majority_srv_from_votes(votes, 1);
   tt_assert(chosen_srv);
-  tt_int_op(chosen_srv->num_reveals, ==, 42);
+  tt_u64_op(chosen_srv->num_reveals, ==, 42);
   tt_mem_op(chosen_srv->value, OP_EQ, SRV_1, sizeof(chosen_srv->value));
 
  done:
@@ -919,7 +919,7 @@ test_utils(void *arg)
     memcpy(srv->value, srv_value, sizeof(srv->value));
     dup_srv = srv_dup(srv);
     tt_assert(dup_srv);
-    tt_int_op(dup_srv->num_reveals, ==, srv->num_reveals);
+    tt_u64_op(dup_srv->num_reveals, ==, srv->num_reveals);
     tt_mem_op(dup_srv->value, OP_EQ, srv->value, sizeof(srv->value));
     tor_free(srv);
     tor_free(dup_srv);



More information about the tor-commits mailing list