From: Stephen Morris Date: Fri, 9 Mar 2012 17:59:58 +0000 (+0000) Subject: [1540] Small formatting corrections X-Git-Tag: trac2351_base~240^2~8^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b8ccce76cae1fd13b07b0c4ce155a5d95d76de12;p=thirdparty%2Fkea.git [1540] Small formatting corrections ... and a change to get the unit test to compile correctly. --- diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc index 672d21eacb..b09d76da8b 100644 --- a/src/lib/dhcp/iface_mgr.cc +++ b/src/lib/dhcp/iface_mgr.cc @@ -894,11 +894,11 @@ Pkt6Ptr IfaceMgr::receive6() { return (Pkt6Ptr()); // NULL } - pkt->setLocalAddr(IOAddress::from_bytes(AF_INET6, reinterpret_cast(&to_addr))); - pkt->setRemoteAddr(IOAddress::from_bytes(AF_INET6, reinterpret_cast(&from.sin6_addr))); - + pkt->setLocalAddr(IOAddress::from_bytes(AF_INET6, + reinterpret_cast(&to_addr))); + pkt->setRemoteAddr(IOAddress::from_bytes(AF_INET6, + reinterpret_cast(&from.sin6_addr))); pkt->setRemotePort(ntohs(from.sin6_port)); - pkt->setIndex(ifindex); Iface* received = getIface(pkt->getIndex()); @@ -922,15 +922,15 @@ Pkt6Ptr IfaceMgr::receive6() { uint16_t IfaceMgr::getSocket(const isc::dhcp::Pkt6& pkt) { Iface* iface = getIface(pkt.getIface()); - if (!iface) { + if (iface == NULL) { isc_throw(BadValue, "Tried to find socket for non-existent interface " << pkt.getIface()); } SocketCollection::const_iterator s; for (s = iface->sockets_.begin(); s != iface->sockets_.end(); ++s) { - if ( (s->family_ == AF_INET6) && - (!s->addr_.getAddress().to_v6().is_multicast()) ) { + if ((s->family_ == AF_INET6) && + (!s->addr_.getAddress().to_v6().is_multicast())) { return (s->sockfd_); } /// @todo: Add more checks here later. If remote address is @@ -944,7 +944,7 @@ uint16_t IfaceMgr::getSocket(const isc::dhcp::Pkt6& pkt) { uint16_t IfaceMgr::getSocket(isc::dhcp::Pkt4 const& pkt) { Iface* iface = getIface(pkt.getIface()); - if (!iface) { + if (iface == NULL) { isc_throw(BadValue, "Tried to find socket for non-existent interface " << pkt.getIface()); } diff --git a/src/lib/dhcp/iface_mgr.h b/src/lib/dhcp/iface_mgr.h index 12605bc465..c643a560d2 100644 --- a/src/lib/dhcp/iface_mgr.h +++ b/src/lib/dhcp/iface_mgr.h @@ -456,7 +456,7 @@ protected: /// @param control_buf_len buffer length /// @param pkt packet to be sent void os_send4(struct msghdr& m, boost::scoped_array& control_buf, - size_t control_buf_len, const Pkt4Ptr& pkt); + size_t control_buf_len, const Pkt4Ptr& pkt); /// @brief OS-specific operations during IPv4 packet reception /// @@ -468,7 +468,7 @@ protected: private: - /// creates a single instance of this class (a singleton implementation) + /// @brief Creates a single instance of this class (a singleton implementation) static void instanceCreate(); diff --git a/src/lib/util/range_utilities.h b/src/lib/util/range_utilities.h index b5d63d9cfd..3ba2cb5b0e 100644 --- a/src/lib/util/range_utilities.h +++ b/src/lib/util/range_utilities.h @@ -15,6 +15,7 @@ #ifndef __RANGE_UTIL_H_ #define __RANGE_UTIL_H_ 1 +#include #include // This header contains useful methods for conduction operations on @@ -54,9 +55,10 @@ isRangeZero(Iterator begin, Iterator end) { /// @param begin /// @param end template -void fillRandom(Iterator begin, Iterator end) { - for (Iterator x=begin; x != end; ++x) { - *x = rand(); +void +fillRandom(Iterator begin, Iterator end) { + for (Iterator x = begin; x != end; ++x) { + *x = std::rand(); } } diff --git a/src/lib/util/tests/buffer_unittest.cc b/src/lib/util/tests/buffer_unittest.cc index 5edd763d5c..66156380e6 100644 --- a/src/lib/util/tests/buffer_unittest.cc +++ b/src/lib/util/tests/buffer_unittest.cc @@ -283,7 +283,7 @@ TEST_F(BufferTest, inputBufferConstructorVector) { std::vector vec2; EXPECT_NO_THROW(buf.readVector(vec2, 17)); - EXPECT_EQ(vec, vec2); + EXPECT_TRUE(vec == vec2); } }