more explicit constructors
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Fri, 21 May 2010 10:23:20 +0000 (04:23 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Fri, 21 May 2010 10:23:20 +0000 (04:23 -0600)
src/Moof/Packet.cc
src/Moof/Socket.hh

index bb8fcc7b88bb9a2413526c9a40ab8164b0b7e7e7..437438effd73803b814123f3bfbea4ab32c45be4 100644 (file)
@@ -182,22 +182,22 @@ Packet& Packet::operator<<(bool value)
 
 Packet& Packet::operator<<(int8_t value)
 {
-       return *this << (uint8_t)value;
+       return *this << reinterpret_cast<uint8_t&>(value);
 }
 
 Packet& Packet::operator<<(int16_t value)
 {
-       return *this << (uint16_t)value;
+       return *this << reinterpret_cast<uint16_t&>(value);
 }
 
 Packet& Packet::operator<<(int32_t value)
 {
-       return *this << (uint32_t)value;
+       return *this << reinterpret_cast<uint32_t&>(value);
 }
 
 Packet& Packet::operator<<(int64_t value)
 {
-       return *this << (uint64_t)value;
+       return *this << reinterpret_cast<uint64_t&>(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<uint8_t&>(value);
 }
 
 Packet& Packet::operator>>(int16_t& value)
 {
-       return *this >> (uint16_t&)value;
+       return *this >> reinterpret_cast<uint16_t&>(value);
 }
 
 Packet& Packet::operator>>(int32_t& value)
 {
-       return *this >> (uint32_t&)value;
+       return *this >> reinterpret_cast<uint32_t&>(value);
 }
 
 Packet& Packet::operator>>(int64_t& value)
 {
-       return *this >> (uint64_t&)value;
+       return *this >> reinterpret_cast<uint64_t&>(value);
 }
 
 Packet& Packet::operator>>(uint8_t& value)
index 17e841cca87ba4170b82637fe0dd53aecb349581..cc47f32ee41cf46f5c8bd38a8e9363fbc4e1171c 100644 (file)
@@ -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) {}
 
 
This page took 0.022877 seconds and 4 git commands to generate.