You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ca...@apache.org on 2013/06/03 20:31:01 UTC

git commit: THRIFT-1992: Fix TCompactProtocol compiler warnings Client: cpp Patch: Konrad Grochowski

Updated Branches:
  refs/heads/master 111d8f261 -> 3e9371146


THRIFT-1992: Fix TCompactProtocol compiler warnings
Client: cpp
Patch: Konrad Grochowski


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/3e937114
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/3e937114
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/3e937114

Branch: refs/heads/master
Commit: 3e937114643fb32f0f8dc96359f11f9df008e782
Parents: 111d8f2
Author: Carl Yeksigian <ca...@apache.org>
Authored: Mon Jun 3 13:46:51 2013 -0400
Committer: Carl Yeksigian <ca...@apache.org>
Committed: Mon Jun 3 14:23:55 2013 -0400

----------------------------------------------------------------------
 lib/cpp/src/thrift/protocol/TCompactProtocol.tcc |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/3e937114/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc b/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
index 79f1b6b..1d93cba 100644
--- a/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
+++ b/lib/cpp/src/thrift/protocol/TCompactProtocol.tcc
@@ -641,12 +641,13 @@ uint32_t TCompactProtocolT<Transport_>::readDouble(double& dub) {
   BOOST_STATIC_ASSERT(sizeof(double) == sizeof(uint64_t));
   BOOST_STATIC_ASSERT(std::numeric_limits<double>::is_iec559);
 
-  uint64_t bits;
-  uint8_t b[8];
-  trans_->readAll(b, 8);
-  bits = *(uint64_t*)b;
-  bits = letohll(bits);
-  dub = bitwise_cast<double>(bits);
+  union {
+    uint64_t bits;
+    uint8_t b[8];
+  } u;
+  trans_->readAll(u.b, 8);
+  u.bits = letohll(u.bits);
+  dub = bitwise_cast<double>(u.bits);
   return 8;
 }