[tor-commits] [trunnel/master] Silence spurious clang implicit 64 to 32 bit truncation warnings in trunnel

nickm at torproject.org nickm at torproject.org
Fri Oct 31 12:53:48 UTC 2014


commit 8d372beb3fa7c5fc03648e2f60e08ffa6bcf5010
Author: teor <teor2345 at gmail.com>
Date:   Fri Oct 31 08:53:39 2014 -0400

    Silence spurious clang implicit 64 to 32 bit truncation warnings in trunnel
    
    clang warns that a few implicit casts in trunnel truncate values from
    64 to 32 bit. We do explicit casts to silence these warnings.
---
 lib/trunnel/data/trunnel.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/trunnel/data/trunnel.c b/lib/trunnel/data/trunnel.c
index 4bc28e3..4c56449 100644
--- a/lib/trunnel/data/trunnel.c
+++ b/lib/trunnel/data/trunnel.c
@@ -71,7 +71,8 @@ uint64_t
 trunnel_htonll(uint64_t a)
 {
 #ifdef IS_LITTLE_ENDIAN
-  return trunnel_htonl(a>>32) | (((uint64_t)trunnel_htonl(a))<<32);
+  return trunnel_htonl((uint32_t)(a>>32))
+    | (((uint64_t)trunnel_htonl((uint32_t)a))<<32);
 #else
   return a;
 #endif



More information about the tor-commits mailing list