From: tho Date: Tue, 8 Jun 2010 10:51:51 +0000 (+0000) Subject: Packets: support is() for in-valid Packets X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=fe0d7de8d8f1044759fabdbb534fef41f9944ffc;p=senf.git Packets: support is() for in-valid Packets git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1635 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/PPI/SocketSink.hh b/senf/PPI/SocketSink.hh index a42a0b9..03b64c1 100644 --- a/senf/PPI/SocketSink.hh +++ b/senf/PPI/SocketSink.hh @@ -302,7 +302,7 @@ namespace module { Handle & handle(); ///< Access handle void handle(Handle handle); ///< Set handle /**< Assigning an empty or in-valid() handle will disable - the module until a new. valid handle is assigned. */ + the module until a new valid handle is assigned. */ #ifndef DOXYGEN void replaceHandle(Handle newHandle); diff --git a/senf/Packets/Packet.cti b/senf/Packets/Packet.cti index 5d79a2b..9ba8a4b 100644 --- a/senf/Packets/Packet.cti +++ b/senf/Packets/Packet.cti @@ -54,7 +54,7 @@ template prefix_ bool senf::Packet::is() const { - return ptr()->is(); + return valid() && ptr()->is(); } template diff --git a/senf/Packets/Packet.test.cc b/senf/Packets/Packet.test.cc index e917d72..aeca47d 100644 --- a/senf/Packets/Packet.test.cc +++ b/senf/Packets/Packet.test.cc @@ -152,12 +152,14 @@ namespace { SENF_AUTO_UNIT_TEST(packet) { + BOOST_CHECK(! senf::Packet().is() ); senf::Packet packet (FooPacket::create()); BarPacket::createAfter(packet); BOOST_REQUIRE( packet ); BOOST_CHECK( packet.next() ); BOOST_CHECK( ! packet.next().next(senf::nothrow) ); + BOOST_CHECK( ! packet.next().next(senf::nothrow).is() ); BOOST_CHECK( ! packet.prev(senf::nothrow) ); BOOST_CHECK( packet.next().prev() == packet ); SENF_CHECK_NOT_EQUAL( packet.next(), packet );