From: JINMEI Tatuya Date: Sat, 9 Jun 2012 01:05:01 +0000 (-0700) Subject: [1975] more editorial cleanups: spacing, doxygen format for code; const. X-Git-Tag: trac2351_base~97^2~9^2~4^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e4cd528b8c10c707616b0dedbb3cc61573da7a6;p=thirdparty%2Fkea.git [1975] more editorial cleanups: spacing, doxygen format for code; const. --- diff --git a/src/lib/datasrc/container.h b/src/lib/datasrc/container.h index f8792e4e11..7d6f2a18fe 100644 --- a/src/lib/datasrc/container.h +++ b/src/lib/datasrc/container.h @@ -126,23 +126,23 @@ public: /// this case, the zone finder is needed and the best matching superzone /// of the searched name is needed. Therefore, the call would look like: /// - /// SearchResult result(container->search(queried_name)); - /// if (result.datasrc_) { - /// createTheAnswer(result.finder_); - /// } else { - /// createNotAuthAnswer(); - /// } + /// \code SearchResult result(container->search(queried_name)); + /// if (result.datasrc_ != NULL) { + /// createTheAnswer(result.finder_); + /// } else { + /// createNotAuthAnswer(); + /// } \endcode /// /// The other scenario is manipulating zone data (XfrOut, XfrIn, DDNS, /// ...). In this case, the finder itself is not so important. However, /// we need an exact match (if we want to manipulate zone data, we must /// know exactly, which zone we are about to manipulate). Then the call /// - /// SearchResult result(container->search(zone_name, true, false)); - /// if (result.datasrc_) { - /// ZoneUpdaterPtr updater(result.datasrc_->getUpdater(zone_name); - /// ... - /// } + /// \code SearchResult result(container->search(zone_name, true, false)); + /// if (result.datasrc_ != NULL) { + /// ZoneUpdaterPtr updater(result.datasrc_->getUpdater(zone_name); + /// ... + /// } \endcode /// /// \param zone The name of the zone to search. /// \param want_exact_match If it is true, it returns only exact matches. diff --git a/src/lib/datasrc/tests/container_unittest.cc b/src/lib/datasrc/tests/container_unittest.cc index a4aec1cabe..3059b90f50 100644 --- a/src/lib/datasrc/tests/container_unittest.cc +++ b/src/lib/datasrc/tests/container_unittest.cc @@ -65,7 +65,7 @@ public: }; // Constructor from a list of zones. TestDS(const char* zone_names[]) { - for (const char** zone(zone_names); *zone; ++ zone) { + for (const char** zone(zone_names); *zone != NULL; ++zone) { zones.insert(Name(*zone)); } } @@ -80,8 +80,8 @@ public: return (FindResult(result::NOTFOUND, ZoneFinderPtr())); } set::const_iterator it(zones.upper_bound(name)); - -- it; - NameComparisonResult compar(it->compare(name)); + --it; + const NameComparisonResult compar(it->compare(name)); const ZoneFinderPtr finder(new Finder(*it)); switch (compar.getRelation()) { case NameComparisonResult::EQUAL: @@ -217,9 +217,10 @@ public: FAIL() << "Unknown configuration index " << index; } } - void checkDS(size_t index, const string& type, const string& params) { + void checkDS(size_t index, const string& type, const string& params) const + { ASSERT_GT(container_->dataSources().size(), index); - TestDS* ds(dynamic_cast( + const TestDS* ds(dynamic_cast( container_->dataSources()[index].data_src_)); // Comparing with NULL does not work ASSERT_TRUE(ds); @@ -294,7 +295,7 @@ TEST_F(ContainerTest, singleDSBestMatch) { ds_[0], Name("example.org"), false, "Subdomain match"); } -const char* test_names[] = { +const char* const test_names[] = { "Sub second", "Sub first", "With empty", @@ -303,7 +304,7 @@ const char* test_names[] = { TEST_F(ContainerTest, multiExactMatch) { // Run through all the multi-configurations - for (size_t i(0); i < 4; ++ i) { + for (size_t i(0); i < 4; ++i) { SCOPED_TRACE(test_names[i]); multiConfiguration(i); // Something that is nowhere there