BIND 10 trac1540, updated. b8ccce76cae1fd13b07b0c4ce155a5d95d76de12 [1540] Small formatting corrections

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Mar 9 18:01:10 UTC 2012


The branch, trac1540 has been updated
       via  b8ccce76cae1fd13b07b0c4ce155a5d95d76de12 (commit)
      from  485f7966f583f54cf2694f054de6accea9c19364 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b8ccce76cae1fd13b07b0c4ce155a5d95d76de12
Author: Stephen Morris <stephen at isc.org>
Date:   Fri Mar 9 17:59:58 2012 +0000

    [1540] Small formatting corrections
    
    ... and a change to get the unit test to compile correctly.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dhcp/iface_mgr.cc             |   16 ++++++++--------
 src/lib/dhcp/iface_mgr.h              |    4 ++--
 src/lib/util/range_utilities.h        |    8 +++++---
 src/lib/util/tests/buffer_unittest.cc |    2 +-
 4 files changed, 16 insertions(+), 14 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc
index 672d21e..b09d76d 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<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());
     }
diff --git a/src/lib/dhcp/iface_mgr.h b/src/lib/dhcp/iface_mgr.h
index 12605bc..c643a56 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<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();
 
diff --git a/src/lib/util/range_utilities.h b/src/lib/util/range_utilities.h
index b5d63d9..3ba2cb5 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 <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();
     }
 }
 
diff --git a/src/lib/util/tests/buffer_unittest.cc b/src/lib/util/tests/buffer_unittest.cc
index 5edd763..6615638 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<uint8_t> vec2;
     EXPECT_NO_THROW(buf.readVector(vec2, 17));
-    EXPECT_EQ(vec, vec2);
+    EXPECT_TRUE(vec == vec2);
 }
 
 }



More information about the bind10-changes mailing list