diff --git a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h index 4df3620dc..bf0340f47 100644 --- a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h +++ b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h @@ -56,6 +56,11 @@ namespace hazelcast { namespace util { class ByteBuffer; + +template +struct is_trivial_or_uuid : std::is_trivial {}; +template<> +struct is_trivial_or_uuid : std::true_type {}; } namespace cp { @@ -594,7 +599,7 @@ public: std::is_same, typename T::value_type>::value && - std::is_trivial::value && + hazelcast::util::is_trivial_or_uuid::value && std::is_trivial::value, T>::type get() @@ -625,7 +630,7 @@ public: std::is_same, typename T::value_type>::value && - std::is_trivial::value && + hazelcast::util::is_trivial_or_uuid::value && !std::is_trivial::value, T>::type get() @@ -1246,12 +1251,11 @@ public: set(nil); if (!nil) { boost::endian::endian_reverse_inplace( - *reinterpret_cast(uuid.data)); + *reinterpret_cast(&uuid.data[0])); boost::endian::endian_reverse_inplace( - *reinterpret_cast(uuid.data + - util::Bits::LONG_SIZE_IN_BYTES)); + *reinterpret_cast(&uuid.data[util::Bits::LONG_SIZE_IN_BYTES])); std::memcpy(wr_ptr(sizeof(boost::uuids::uuid)), - uuid.data, + &uuid.data[0], sizeof(boost::uuids::uuid)); } else { wr_ptr(sizeof(boost::uuids::uuid)); @@ -1525,13 +1529,13 @@ private: boost::uuids::uuid get_uuid() { boost::uuids::uuid u; - memcpy(&u.data, + memcpy(&u.data[0], rd_ptr(sizeof(boost::uuids::uuid)), sizeof(boost::uuids::uuid)); boost::endian::endian_reverse_inplace( - *reinterpret_cast(u.data)); + *reinterpret_cast(&u.data[0])); boost::endian::endian_reverse_inplace( - *reinterpret_cast(u.data + util::Bits::LONG_SIZE_IN_BYTES)); + *reinterpret_cast(&u.data[util::Bits::LONG_SIZE_IN_BYTES])); return u; } diff --git a/hazelcast/include/hazelcast/client/serialization/pimpl/data_input.h b/hazelcast/include/hazelcast/client/serialization/pimpl/data_input.h index 9e678f54d..88a2f14c0 100644 --- a/hazelcast/include/hazelcast/client/serialization/pimpl/data_input.h +++ b/hazelcast/include/hazelcast/client/serialization/pimpl/data_input.h @@ -182,11 +182,11 @@ public: { check_available(util::Bits::UUID_SIZE_IN_BYTES); boost::uuids::uuid u; - std::memcpy(&u.data, &buffer_[pos_], util::Bits::UUID_SIZE_IN_BYTES); + std::memcpy(&u.data[0], &buffer_[pos_], util::Bits::UUID_SIZE_IN_BYTES); pos_ += util::Bits::UUID_SIZE_IN_BYTES; if (byte_order_ == boost::endian::order::little) { boost::endian::endian_reverse_inplace( - *reinterpret_cast(u.data)); + *reinterpret_cast(&u.data[0])); boost::endian::endian_reverse_inplace( *reinterpret_cast( &u.data[util::Bits::LONG_SIZE_IN_BYTES])); diff --git a/hazelcast/include/hazelcast/client/spi/impl/ClientInvocation.h b/hazelcast/include/hazelcast/client/spi/impl/ClientInvocation.h index 5b3186347..625c642b2 100644 --- a/hazelcast/include/hazelcast/client/spi/impl/ClientInvocation.h +++ b/hazelcast/include/hazelcast/client/spi/impl/ClientInvocation.h @@ -210,22 +210,7 @@ private: const std::string& name, int partition = UNASSIGNED_PARTITION, const std::shared_ptr& conn = nullptr, - boost::uuids::uuid uuid = { 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0 }); + boost::uuids::uuid uuid = {}); void invoke_on_selection(); diff --git a/hazelcast/src/hazelcast/client/protocol.cpp b/hazelcast/src/hazelcast/client/protocol.cpp index cfc67f26f..934d9da4b 100644 --- a/hazelcast/src/hazelcast/client/protocol.cpp +++ b/hazelcast/src/hazelcast/client/protocol.cpp @@ -376,7 +376,7 @@ operator<<(std::ostream& os, const ClientMessage& msg) void ClientMessage::set(unsigned char* /* memory */, boost::uuids::uuid uuid) { - std::memcpy(wr_ptr(uuid.size()), uuid.data, uuid.size()); + std::memcpy(wr_ptr(uuid.size()), &uuid.data[0], uuid.size()); } void diff --git a/hazelcast/src/hazelcast/client/serialization.cpp b/hazelcast/src/hazelcast/client/serialization.cpp index 071772fec..8dcb6ccf0 100644 --- a/hazelcast/src/hazelcast/client/serialization.cpp +++ b/hazelcast/src/hazelcast/client/serialization.cpp @@ -731,12 +731,12 @@ data_output::write(boost::uuids::uuid v) } if (byte_order_ == boost::endian::order::little) { boost::endian::endian_reverse_inplace( - *reinterpret_cast(v.data)); + *reinterpret_cast(&v.data[0])); boost::endian::endian_reverse_inplace( *reinterpret_cast(&v.data[util::Bits::LONG_SIZE_IN_BYTES])); } output_stream_.insert( - output_stream_.end(), v.data, v.data + util::Bits::UUID_SIZE_IN_BYTES); + output_stream_.end(), &v.data[0], &v.data[util::Bits::LONG_SIZE_IN_BYTES]); } template<>