From c85b710e7ead9bc417805bb893571a7139f1081c Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Fri, 21 May 2010 04:23:20 -0600 Subject: [PATCH] more explicit constructors --- src/Moof/Packet.cc | 16 ++++++++-------- src/Moof/Socket.hh | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Moof/Packet.cc b/src/Moof/Packet.cc index bb8fcc7..437438e 100644 --- a/src/Moof/Packet.cc +++ b/src/Moof/Packet.cc @@ -182,22 +182,22 @@ Packet& Packet::operator<<(bool value) Packet& Packet::operator<<(int8_t value) { - return *this << (uint8_t)value; + return *this << reinterpret_cast(value); } Packet& Packet::operator<<(int16_t value) { - return *this << (uint16_t)value; + return *this << reinterpret_cast(value); } Packet& Packet::operator<<(int32_t value) { - return *this << (uint32_t)value; + return *this << reinterpret_cast(value); } Packet& Packet::operator<<(int64_t value) { - return *this << (uint64_t)value; + return *this << reinterpret_cast(value); } @@ -305,22 +305,22 @@ Packet& Packet::operator>>(bool& value) Packet& Packet::operator>>(int8_t& value) { - return *this >> (uint8_t&)value; + return *this >> reinterpret_cast(value); } Packet& Packet::operator>>(int16_t& value) { - return *this >> (uint16_t&)value; + return *this >> reinterpret_cast(value); } Packet& Packet::operator>>(int32_t& value) { - return *this >> (uint32_t&)value; + return *this >> reinterpret_cast(value); } Packet& Packet::operator>>(int64_t& value) { - return *this >> (uint64_t&)value; + return *this >> reinterpret_cast(value); } Packet& Packet::operator>>(uint8_t& value) diff --git a/src/Moof/Socket.hh b/src/Moof/Socket.hh index 17e841c..cc47f32 100644 --- a/src/Moof/Socket.hh +++ b/src/Moof/Socket.hh @@ -95,9 +95,9 @@ public: * \param type The type of socket; either SOCK_STREAM or SOCK_DGRAM. * \param family The family; can be AF_INET or AF_INET6. */ - SocketAddress(const std::string& service, - int type = SOCK_STREAM, - int family = AF_UNSPEC) + explicit SocketAddress(const std::string& service, + int type = SOCK_STREAM, + int family = AF_UNSPEC) { init(service, type, family); } @@ -527,10 +527,10 @@ public: * \param family The family; can be AF_INET or AF_INET6. * \param flags The socket options. */ - Socket(const std::string& service, - int type = SOCK_STREAM, - int family = AF_UNSPEC, - int flags = 0) : + explicit Socket(const std::string& service, + int type = SOCK_STREAM, + int family = AF_UNSPEC, + int flags = 0) : mImpl(SocketAddress(service, type, family), flags) {} @@ -921,7 +921,7 @@ public: Packet&, const SocketAddress&)> Function; - SocketMultiplexer(Socket sock) : + explicit SocketMultiplexer(Socket sock) : mSocket(sock) {} -- 2.43.0