From: Charles McGarvey Date: Fri, 21 May 2010 10:23:20 +0000 (-0600) Subject: more explicit constructors X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=c85b710e7ead9bc417805bb893571a7139f1081c;p=chaz%2Fyoink more explicit constructors --- 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) {}