]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1540] Small formatting corrections
authorStephen Morris <stephen@isc.org>
Fri, 9 Mar 2012 17:59:58 +0000 (17:59 +0000)
committerStephen Morris <stephen@isc.org>
Fri, 9 Mar 2012 17:59:58 +0000 (17:59 +0000)
... and a change to get the unit test to compile correctly.

src/lib/dhcp/iface_mgr.cc
src/lib/dhcp/iface_mgr.h
src/lib/util/range_utilities.h
src/lib/util/tests/buffer_unittest.cc

index 672d21eacb1c4623190404fb2337d23c596a1ee0..b09d76da8b7d1b91238fef03e7df039a9b74b6fe 100644 (file)
@@ -894,11 +894,11 @@ Pkt6Ptr IfaceMgr::receive6() {
         return (Pkt6Ptr()); // NULL
     }
 
-    pkt->setLocalAddr(IOAddress::from_bytes(AF_INET6, reinterpret_cast<const uint8_t*>(&to_addr)));
-    pkt->setRemoteAddr(IOAddress::from_bytes(AF_INET6, reinterpret_cast<const uint8_t*>(&from.sin6_addr)));
-
+    pkt->setLocalAddr(IOAddress::from_bytes(AF_INET6,
+                      reinterpret_cast<const uint8_t*>(&to_addr)));
+    pkt->setRemoteAddr(IOAddress::from_bytes(AF_INET6,
+                       reinterpret_cast<const uint8_t*>(&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());
     }
index 12605bc465a3d737e0a2c5bdf4a05f3f11eb1683..c643a560d277c79610eb91e1d2551360ba058f0c 100644 (file)
@@ -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<char>& 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();
 
index b5d63d9cfdcabcccd456edbd2059ef3ebd6e730f..3ba2cb5b0e288dafe2f7dcabf258351a1a5bd205 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef __RANGE_UTIL_H_
 #define __RANGE_UTIL_H_ 1
 
+#include <cstdlib>
 #include <algorithm>
 
 // This header contains useful methods for conduction operations on
@@ -54,9 +55,10 @@ isRangeZero(Iterator begin, Iterator end) {
 /// @param begin
 /// @param end
 template <typename Iterator>
-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();
     }
 }
 
index 5edd763d5c206746c9f7e7fbcc993b2aff53ad4e..66156380e69e0834a90e7bdfee290ee6fb311dc7 100644 (file)
@@ -283,7 +283,7 @@ TEST_F(BufferTest, inputBufferConstructorVector) {
 
     std::vector<uint8_t> vec2;
     EXPECT_NO_THROW(buf.readVector(vec2, 17));
-    EXPECT_EQ(vec, vec2);
+    EXPECT_TRUE(vec == vec2);
 }
 
 }