Browse Source

Fix some 32-bit warnings and clang warnings

Nick Mathewson 7 years ago
parent
commit
f45a581486
2 changed files with 8 additions and 8 deletions
  1. 5 5
      src/or/hs_descriptor.c
  2. 3 3
      src/test/test_hs_descriptor.c

+ 5 - 5
src/or/hs_descriptor.c

@@ -1057,7 +1057,7 @@ encrypted_data_length_is_valid(size_t len)
   if (len < HS_DESC_ENCRYPTED_MIN_LEN) {
     log_warn(LD_REND, "Length of descriptor's encrypted data is too small. "
                       "Got %lu but minimum value is %d",
-             len, HS_DESC_ENCRYPTED_MIN_LEN);
+             (unsigned long)len, HS_DESC_ENCRYPTED_MIN_LEN);
     goto err;
   }
 
@@ -1069,7 +1069,7 @@ encrypted_data_length_is_valid(size_t len)
   if (len % HS_DESC_PLAINTEXT_PADDING_MULTIPLE) {
     log_warn(LD_REND, "Length of descriptor's encrypted data is invalid. "
                       "Got %lu which is not a multiple of %d.",
-             len, HS_DESC_PLAINTEXT_PADDING_MULTIPLE);
+             (unsigned long) len, HS_DESC_PLAINTEXT_PADDING_MULTIPLE);
     goto err;
   }
 
@@ -1121,7 +1121,7 @@ desc_decrypt_data_v3(const hs_descriptor_t *desc, char **decrypted_out)
     if (desc_mac_size != DIGEST256_LEN) {
       log_warn(LD_REND, "Service descriptor MAC length of encrypted data "
                         "is invalid (%lu, expected %u)",
-               desc_mac_size, DIGEST256_LEN);
+               (unsigned long) desc_mac_size, DIGEST256_LEN);
       goto err;
     }
   }
@@ -1419,7 +1419,7 @@ desc_sig_is_valid(const char *b64_sig, const ed25519_keypair_t *signing_kp,
   if (strlen(b64_sig) != ED25519_SIG_BASE64_LEN) {
     log_warn(LD_REND, "Service descriptor has an invalid signature length."
                       "Exptected %d but got %lu",
-             ED25519_SIG_BASE64_LEN, strlen(b64_sig));
+             ED25519_SIG_BASE64_LEN, (unsigned long) strlen(b64_sig));
     goto err;
   }
 
@@ -1733,7 +1733,7 @@ hs_desc_decode_plaintext(const char *encoded,
   encoded_len = strlen(encoded);
   if (encoded_len >= HS_DESC_MAX_LEN) {
     log_warn(LD_REND, "Service descriptor is too big (%lu bytes)",
-             encoded_len);
+             (unsigned long) encoded_len);
     goto err;
   }
 

+ 3 - 3
src/test/test_hs_descriptor.c

@@ -142,7 +142,7 @@ helper_compare_hs_desc(const hs_descriptor_t *desc1,
   tt_mem_op(desc1->plaintext_data.blinded_kp.pubkey.pubkey, OP_EQ,
             desc2->plaintext_data.blinded_kp.pubkey.pubkey,
             ED25519_PUBKEY_LEN);
-  tt_uint_op(desc1->plaintext_data.revision_counter, ==,
+  tt_u64_op(desc1->plaintext_data.revision_counter, ==,
              desc2->plaintext_data.revision_counter);
 
   /* NOTE: We can't compare the encrypted blob because when encoding the
@@ -812,7 +812,7 @@ test_decode_intro_point(void *arg)
   desc_intro_point_free(ip);
 }
 
-const char encrypted_desc_portion[] = "create2-formats 2\n"
+static const char encrypted_desc_portion[] = "create2-formats 2\n"
   "authentication-required ed25519\n"
   "introduction-point AQAGAQIDBCMp\n"
   "auth-key\n"
@@ -1056,7 +1056,7 @@ static void
 test_desc_signature(void *arg)
 {
   int ret;
-  char *data, *desc;
+  char *data = NULL, *desc = NULL;
   char sig_b64[ED25519_SIG_BASE64_LEN + 1];
   ed25519_keypair_t kp;
   ed25519_signature_t sig;