BIND 10 master, updated. 56bd0746aef2a0b789402844e041a268b889b081 [master] removed the typeo conversion operator from IOAddress to char*. its counter intuitive behavior and surprising results rarely justify the introduction, and, in fact, it caused a regression: http://git.bind10.isc.org/~tester/builder/BIND10/20111007175000-Solaris10-sparc-Sunstudio/logs/unittests.out Apparently the reason why this was introduced is to assist the comparison tests used in a dhcp6 test. To work this around I replaced the test code using toText(). The right solution is to introduce operator<< for IOAddress, which will satisfy gtest (we already have operator== so EXPECT_EQ should work otherwise).

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Oct 7 22:14:24 UTC 2011


The branch, master has been updated
       via  56bd0746aef2a0b789402844e041a268b889b081 (commit)
      from  6117a5805ef05672b9e05e961f7fa0f8aa5fca0e (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 56bd0746aef2a0b789402844e041a268b889b081
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Oct 7 15:09:06 2011 -0700

    [master] removed the typeo conversion operator from IOAddress to char*.
    its counter intuitive behavior and surprising results rarely justify
    the introduction, and, in fact, it caused a regression:
    http://git.bind10.isc.org/~tester/builder/BIND10/20111007175000-Solaris10-sparc-Sunstudio/logs/unittests.out
    Apparently the reason why this was introduced is to assist the comparison
    tests used in a dhcp6 test.  To work this around I replaced the test code
    using toText().  The right solution is to introduce operator<< for IOAddress,
    which will satisfy gtest (we already have operator== so EXPECT_EQ should
    work otherwise).

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

Summary of changes:
 src/bin/dhcp6/tests/iface_mgr_unittest.cc     |    2 +-
 src/lib/asiolink/io_address.h                 |    5 -----
 src/lib/asiolink/tests/io_address_unittest.cc |    1 -
 3 files changed, 1 insertions(+), 7 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/dhcp6/tests/iface_mgr_unittest.cc b/src/bin/dhcp6/tests/iface_mgr_unittest.cc
index eaadb22..3f793a1 100644
--- a/src/bin/dhcp6/tests/iface_mgr_unittest.cc
+++ b/src/bin/dhcp6/tests/iface_mgr_unittest.cc
@@ -250,7 +250,7 @@ TEST_F(IfaceMgrTest, DISABLED_sendReceive) {
     EXPECT_EQ(0, memcmp(&sendPkt.data_[0], &rcvPkt->data_[0],
                         rcvPkt->data_len_) );
 
-    EXPECT_EQ(sendPkt.remote_addr_, rcvPkt->remote_addr_);
+    EXPECT_EQ(sendPkt.remote_addr_.toText(), rcvPkt->remote_addr_.toText());
     EXPECT_EQ(rcvPkt->remote_port_, 10546);
 
     delete rcvPkt;
diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h
index 1a42da7..1b488fa 100644
--- a/src/lib/asiolink/io_address.h
+++ b/src/lib/asiolink/io_address.h
@@ -74,11 +74,6 @@ public:
     /// \return A string representation of the address.
     std::string toText() const;
 
-    /// \brief Convert the address to a C-style null-terminated string.
-    ///
-    /// \return A string representation of the address.
-    operator const char*() const { return toText().c_str(); }
-
     /// \brief Returns const reference to the underlying address object.
     ///
     /// This is useful, when access to interface offerted by
diff --git a/src/lib/asiolink/tests/io_address_unittest.cc b/src/lib/asiolink/tests/io_address_unittest.cc
index b2a0dcc..56368a1 100644
--- a/src/lib/asiolink/tests/io_address_unittest.cc
+++ b/src/lib/asiolink/tests/io_address_unittest.cc
@@ -25,7 +25,6 @@ using namespace isc::asiolink;
 TEST(IOAddressTest, fromText) {
     IOAddress io_address_v4("192.0.2.1");
     EXPECT_EQ("192.0.2.1", io_address_v4.toText());
-    EXPECT_EQ(0, strcmp("192.0.2.1", (const char *)io_address_v4));
 
     IOAddress io_address_v6("2001:db8::1234");
     EXPECT_EQ("2001:db8::1234", io_address_v6.toText());




More information about the bind10-changes mailing list