diff --git a/src/core/model/hash.cc b/src/core/model/hash.cc index bb387a661..8a827ac2e 100644 --- a/src/core/model/hash.cc +++ b/src/core/model/hash.cc @@ -42,11 +42,11 @@ Hash::Hash (Ptr hp) NS_ASSERT (m_impl != 0); } -Hash * +Hash & Hash::clear (void) { m_impl->clear(); - return this; + return *this; } } // namespace ns3 diff --git a/src/core/model/hash.h b/src/core/model/hash.h index 6fa2ff031..126db9832 100644 --- a/src/core/model/hash.h +++ b/src/core/model/hash.h @@ -109,7 +109,7 @@ public: * * \return this */ - Hash * clear (void); + Hash & clear (void); private: Ptr m_impl; /** Hash implementation */ diff --git a/src/core/test/hash-test-suite.cc b/src/core/test/hash-test-suite.cc index 0b0e82363..cc91465e9 100644 --- a/src/core/test/hash-test-suite.cc +++ b/src/core/test/hash-test-suite.cc @@ -98,14 +98,14 @@ HashFnv1aTestCase::DoRun (void) Hash hasher = Hash ( Create () ); uint32_t h32r = 0x5735855b; // FNV1A(key) - uint32_t h32 = hasher.GetHash32 (key); + uint32_t h32 = hasher.clear ().GetHash32 (key); NS_TEST_ASSERT_MSG_EQ (h32, h32r, "Hash32 produced " << std::hex << std::setw ( 8) << h32 << ", expected " << std::hex << std::setw ( 8) << h32r ); uint64_t h64r = 0x6fb0aea4ad83c27b; - uint64_t h64 = hasher.GetHash64 (key); + uint64_t h64 = hasher.clear ().GetHash64 (key); NS_TEST_ASSERT_MSG_EQ (h64, h64r, "Hash64 produced " << std::hex << std::setw (16) << h64 << ", expected " << std::hex << std::setw (16) << h64r @@ -142,14 +142,14 @@ HashMurmur3TestCase::DoRun (void) Hash hasher = Hash ( Create () ); uint32_t h32r = 0xe8a2d100; // Murmur3(key) - uint32_t h32 = hasher.GetHash32 (key); + uint32_t h32 = hasher.clear ().GetHash32 (key); NS_TEST_ASSERT_MSG_EQ (h32, h32r, "Hash32 produced " << std::hex << std::setw ( 8) << h32 << ", expected " << std::hex << std::setw ( 8) << h32r ); uint64_t h64r = 0x95373d091a691071; - uint64_t h64 = hasher.GetHash64 (key); + uint64_t h64 = hasher.clear ().GetHash64 (key); NS_TEST_ASSERT_MSG_EQ (h64, h64r, "Hash64 produced " << std::hex << std::setw (16) << h64 << ", expected " << std::hex << std::setw (16) << h64r