Browse Source

[1579] various style fixes.

- () for return
- indentation
- brace position
- and a few other small things
JINMEI Tatuya 13 years ago
parent
commit
ed4c07d55c
2 changed files with 36 additions and 49 deletions
  1. 22 29
      src/lib/datasrc/database.cc
  2. 14 20
      src/lib/datasrc/tests/database_unittest.cc

+ 22 - 29
src/lib/datasrc/database.cc

@@ -723,14 +723,12 @@ DatabaseClient::Finder::FindDNSSECContext::FindDNSSECContext(
 {}
 
 ZoneFinder::FindOptions
-DatabaseClient::Finder::FindDNSSECContext::getOptions() const
-{
-    return options_;
+DatabaseClient::Finder::FindDNSSECContext::getOptions() const {
+    return (options_);
 }
 
 void
-DatabaseClient::Finder::FindDNSSECContext::init()
-{
+DatabaseClient::Finder::FindDNSSECContext::init() {
     if (finderp_ == NULL) {
         isc_throw(DataSourceError, "no Finder to query");
     }
@@ -754,30 +752,27 @@ DatabaseClient::Finder::FindDNSSECContext::init()
 }
 
 bool
-DatabaseClient::Finder::FindDNSSECContext::isInited()
-{
-    return initialized_;
+DatabaseClient::Finder::FindDNSSECContext::isInited() {
+    return (initialized_);
 }
 
 bool
-DatabaseClient::Finder::FindDNSSECContext::isNSEC3()
-{
+DatabaseClient::Finder::FindDNSSECContext::isNSEC3() {
     if (isInited()) {
-        return is_nsec3_;
+        return (is_nsec3_);
     } else {
         init();
-        return is_nsec3_;
+        return (is_nsec3_);
     }
 }
 
 bool
-DatabaseClient::Finder::FindDNSSECContext::isNSEC()
-{
+DatabaseClient::Finder::FindDNSSECContext::isNSEC() {
     if (isInited()) {
-        return is_nsec_;
+        return (is_nsec_);
     } else {
         init();
-        return is_nsec_;
+        return (is_nsec_);
     }
 }
 
@@ -787,9 +782,9 @@ DatabaseClient::Finder::FindDNSSECContext::getNSECRRset(
 {
     const FoundIterator nci = found_set.second.find(RRType::NSEC());
     if (nci != found_set.second.end()) {
-        return nci->second;
+        return (nci->second);
     } else {
-        return ConstRRsetPtr();
+        return (ConstRRsetPtr());
     }
 }
 
@@ -803,9 +798,9 @@ DatabaseClient::Finder::FindDNSSECContext::getNSECRRset(const Name &name) const
                                                    true);
     const FoundIterator nci = wfound.second.find(RRType::NSEC());
     if (nci != wfound.second.end()) {
-        return nci->second;
+        return (nci->second);
     } else {
-        return ConstRRsetPtr();
+        return (ConstRRsetPtr());
     }
 }
 
@@ -825,22 +820,20 @@ DatabaseClient::Finder::FindDNSSECContext::getDNSSECRRset(const Name& name,
 }
 
 bool
-DatabaseClient::Finder::FindDNSSECContext::isOrigin(const Name &name) const
-{
+DatabaseClient::Finder::FindDNSSECContext::isOrigin(const Name &name) const {
     return (name == origin_);
 }
 
 ZoneFinder::FindResultFlags
-DatabaseClient::Finder::FindDNSSECContext::getResultFlags()
-{
+DatabaseClient::Finder::FindDNSSECContext::getResultFlags() {
     // If it is not DNSSEC query, it should return RESULT_DEFAULT
     if ((options_ & FIND_DNSSEC) == 0) {
-        return RESULT_DEFAULT;
+        return (RESULT_DEFAULT);
     }
     // If it is a DNSSEC query and the zone is signed with NSEC3, it should
     // return RESULT_NSEC3_SIGNED
     if (isNSEC3()) {
-        return RESULT_NSEC3_SIGNED;
+        return (RESULT_NSEC3_SIGNED);
     } else {
         // If it is a DNSSEC query and the zone is signed with NSEC, it should
         // return RESULT_NSEC_SIGNED, other else, return RESULT_DEFAULT
@@ -965,7 +958,7 @@ DatabaseClient::Finder::findNoNameResult(const Name& name, const RRType& type,
     // for special cases.
 
     if (hasSubdomains(name.toText())) {
-        // Does the domain have a subdomain (i.e. it is an empty non-terminal)
+        // Does the domain have a subdomain (i.e. it is an empty non-terminal)?
         // If so, return NXRRSET instead of NXDOMAIN (as although the name does
         // not exist in the database, it does exist in the DNS tree).
         LOG_DEBUG(logger, DBG_TRACE_DETAILED,
@@ -973,7 +966,7 @@ DatabaseClient::Finder::findNoNameResult(const Name& name, const RRType& type,
             arg(accessor_->getDBName()).arg(name);
         const ConstRRsetPtr nsec = dnssec_ctx.isNSEC() ? findNSECCover(name) :
             ConstRRsetPtr();
-        if(dnssec_ctx.isNSEC() && (!nsec)){
+        if(dnssec_ctx.isNSEC() && !nsec){
             isc_throw(DataSourceError,
                       "no NSEC RR covers in the NSEC signed zone");
         }
@@ -996,7 +989,7 @@ DatabaseClient::Finder::findNoNameResult(const Name& name, const RRType& type,
               arg(accessor_->getDBName()).arg(name).arg(type).arg(getClass());
     const ConstRRsetPtr nsec = dnssec_ctx.isNSEC() ? findNSECCover(name) :
         ConstRRsetPtr();
-    if(dnssec_ctx.isNSEC() && (!nsec)){
+    if(dnssec_ctx.isNSEC() && !nsec){
         isc_throw(DataSourceError, "no NSEC RR covers in the NSEC signed zone");
     }
     return (ResultContext(NXDOMAIN, nsec, dnssec_ctx.getResultFlags()));

+ 14 - 20
src/lib/datasrc/tests/database_unittest.cc

@@ -2377,10 +2377,10 @@ TYPED_TEST(DatabaseClientTest, nsec3FlagFindDB) {
     this->expected_rdatas_.clear();
     this->expected_sig_rdatas_.clear();
     doFindTest(this->updater_->getFinder(), Name("www1.example.org."),
-            this->qtype_, this->qtype_, this->rrttl_, ZoneFinder::NXDOMAIN,
-            this->expected_rdatas_, this->expected_sig_rdatas_,
-            ZoneFinder::RESULT_NSEC3_SIGNED,Name::ROOT_NAME(),
-            ZoneFinder::FIND_DNSSEC);
+               this->qtype_, this->qtype_, this->rrttl_, ZoneFinder::NXDOMAIN,
+               this->expected_rdatas_, this->expected_sig_rdatas_,
+               ZoneFinder::RESULT_NSEC3_SIGNED,Name::ROOT_NAME(),
+               ZoneFinder::FIND_DNSSEC);
 
     // check NXRRSET, it should set RESULT_NSEC3_SIGNED in the flags.
     this->expected_rdatas_.clear();
@@ -2446,14 +2446,11 @@ TYPED_TEST(DatabaseClientTest, NXDOMAIN_NSEC) {
     }
     // If the zone is signed with NSEC, find function should throw an error
     // when no NSEC RRset for NXDOMAIN case.
-    EXPECT_THROW(doFindTest(*finder,
-                               isc::dns::Name("notimplnsec.example.org."),
-                               isc::dns::RRType::TXT(),
-                               isc::dns::RRType::NSEC(), this->rrttl_,
-                               ZoneFinder::NXDOMAIN, this->empty_rdatas_,
-                               this->empty_rdatas_,
-                               ZoneFinder::RESULT_DEFAULT,
-                               Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC),
+    EXPECT_THROW(doFindTest(*finder, Name("notimplnsec.example.org."),
+                            RRType::TXT(), RRType::NSEC(), this->rrttl_,
+                            ZoneFinder::NXDOMAIN, this->empty_rdatas_,
+                            this->empty_rdatas_, ZoneFinder::RESULT_DEFAULT,
+                            Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC),
                  DataSourceError);
 }
 
@@ -2476,14 +2473,11 @@ TYPED_TEST(DatabaseClientTest, emptyNonterminalNSEC) {
     }
     // If the zone is signed with NSEC, find function should throw an error
     // when no NSEC RRset for NXRRset case
-    EXPECT_THROW(doFindTest(*finder,
-                               isc::dns::Name("here.wild.example.org."),
-                               isc::dns::RRType::TXT(),
-                               isc::dns::RRType::NSEC(),
-                               this->rrttl_, ZoneFinder::NXRRSET,
-                               this->empty_rdatas_, this->empty_rdatas_,
-                               ZoneFinder::RESULT_DEFAULT,
-                               Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC),
+    EXPECT_THROW(doFindTest(*finder, Name("here.wild.example.org."),
+                            RRType::TXT(), RRType::NSEC(), this->rrttl_,
+                            ZoneFinder::NXRRSET, this->empty_rdatas_,
+                            this->empty_rdatas_, ZoneFinder::RESULT_DEFAULT,
+                            Name::ROOT_NAME(), ZoneFinder::FIND_DNSSEC),
                  DataSourceError);
 }