BIND 10 trac2096, updated. 220c3ff25ab6bb3e0cd4f4888bdfdaadc87a2738 [2096] editorial cleanups

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Aug 23 23:22:44 UTC 2012


The branch, trac2096 has been updated
       via  220c3ff25ab6bb3e0cd4f4888bdfdaadc87a2738 (commit)
      from  db4962ad778838b6872fa1516a3e2e6c3e2579be (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 220c3ff25ab6bb3e0cd4f4888bdfdaadc87a2738
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Aug 23 16:21:35 2012 -0700

    [2096] editorial cleanups
    
    - spacing
    - const
    - type clarification
    - postion of ++
    - indentation
    - comment wording

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

Summary of changes:
 src/lib/datasrc/memory/rdata_reader.cc             |    3 +--
 src/lib/datasrc/memory/rdata_reader.h              |   16 +++++++-----
 .../memory/tests/rdata_serialization_unittest.cc   |   27 ++++++++++----------
 3 files changed, 23 insertions(+), 23 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/rdata_reader.cc b/src/lib/datasrc/memory/rdata_reader.cc
index 664b9bb..5429fb9 100644
--- a/src/lib/datasrc/memory/rdata_reader.cc
+++ b/src/lib/datasrc/memory/rdata_reader.cc
@@ -54,7 +54,6 @@ RdataReader::Boundary
 RdataReader::nextInternal(const NameAction& name_action,
                           const DataAction& data_action)
 {
-
     if (spec_pos_ < spec_count_) {
         const RdataFieldSpec& spec(spec_.fields[(spec_pos_++) %
                                                 spec_.field_count]);
@@ -64,7 +63,7 @@ RdataReader::nextInternal(const NameAction& name_action,
             name_action(sequence, spec.name_attributes);
         } else {
             const size_t length(spec.type == RdataFieldSpec::FIXEDLEN_DATA ?
-                                spec.fixeddata_len : lengths_[length_pos_ ++]);
+                                spec.fixeddata_len : lengths_[length_pos_++]);
             const uint8_t* const pos = data_ + data_pos_;
             data_pos_ += length;
             data_action(pos, length);
diff --git a/src/lib/datasrc/memory/rdata_reader.h b/src/lib/datasrc/memory/rdata_reader.h
index b2aeb1f..8f50225 100644
--- a/src/lib/datasrc/memory/rdata_reader.h
+++ b/src/lib/datasrc/memory/rdata_reader.h
@@ -47,11 +47,12 @@ namespace memory {
 /// sequence will be
 /// - 2 bytes of opaque data (which corresponds to the MX preference)
 /// - a domain name (which corresponds to the MX name)
+///
 /// If the encoded data contain multiple MX RDATAs, the same type of
 /// sequence continues for the number of RDATAs.  Note that the opaque
-/// data field does not always correspond to a specific RDATA field
+/// data field does not always corresponds to a specific RDATA field
 /// as is the 2-byte preference field of MX.  For example, the field
-/// sequence for an SOA RDATA in terms of `RdataEncoder` will be:
+/// sequence for an SOA RDATA in terms of RdataEncoder will be:
 /// - a domain name (which corresponds to the SOA MNAME)
 /// - a domain name (which corresponds to the SOA RNAME)
 /// - 20 bytes of opaque data (for the rest of fields)
@@ -135,12 +136,13 @@ public:
     /// \brief Call next() until the end.
     ///
     /// This is just convenience method to iterate through all the data.
-    /// It calls next until it reaches the end (it does not rewind before,
+    /// It calls next until it reaches the end (it does not rewind beforehand,
     /// therefore if you already called next() yourself, it does not start
     /// at the beginning).
     void iterate() {
-        while (next() != RRSET_BOUNDARY) { }
+        while (next() != RRSET_BOUNDARY) {}
     }
+
     /// \brief Call next() until the end of current rdata.
     ///
     /// This is a convenience method to iterate until the end of current
@@ -150,7 +152,7 @@ public:
     /// \return If there was Rdata to iterate through.
     bool iterateRdata() {
         while (true) {
-            switch(next()) {
+            switch (next()) {
                 case NO_BOUNDARY: break;
                 case RDATA_BOUNDARY: return (true);
                 case RRSET_BOUNDARY: return (false);
@@ -169,7 +171,7 @@ public:
     /// This is almost the same as iterate(), but it iterates through the
     /// RRSig data instead.
     void iterateAllSigs() {
-        while (nextSig() != RRSET_BOUNDARY) { }
+        while (nextSig() != RRSET_BOUNDARY) {}
     }
 
     /// \brief Iterate through the current RRSig Rdata.
@@ -180,7 +182,7 @@ public:
     /// In practice, this should process one DATA field.
     bool iterateSingleSig() {
         while (true) {
-            switch(nextSig()) {
+            switch (nextSig()) {
                 case NO_BOUNDARY: break;
                 case RDATA_BOUNDARY: return (true);
                 case RRSET_BOUNDARY: return (false);
diff --git a/src/lib/datasrc/memory/tests/rdata_serialization_unittest.cc b/src/lib/datasrc/memory/tests/rdata_serialization_unittest.cc
index fbbd4ef..b7a13d9 100644
--- a/src/lib/datasrc/memory/tests/rdata_serialization_unittest.cc
+++ b/src/lib/datasrc/memory/tests/rdata_serialization_unittest.cc
@@ -102,23 +102,21 @@ const TestRdata test_rdata_list[] = {
 // from encoded representation of each RDATA.
 void
 renderNameField(MessageRenderer* renderer, bool additional_required,
-                const LabelSequence& labels, unsigned attributes)
+                const LabelSequence& labels, RdataNameAttributes attributes)
 {
     EXPECT_EQ(additional_required, (attributes & NAMEATTR_ADDITIONAL) != 0);
     renderer->writeName(labels, (attributes & NAMEATTR_COMPRESSIBLE) != 0);
 }
 
 void
-renderDataField(MessageRenderer* renderer, const void* data,
-                size_t data_len)
-{
+renderDataField(MessageRenderer* renderer, const void* data, size_t data_len) {
     renderer->writeData(data, data_len);
 }
 
 class RdataSerializationTest : public ::testing::Test {
 protected:
     RdataSerializationTest() : a_rdata_(createRdata(RRType::A(), RRClass::IN(),
-                                              "192.0.2.53")),
+                                                    "192.0.2.53")),
                          aaaa_rdata_(createRdata(RRType::AAAA(), RRClass::IN(),
                                                  "2001:db8::53")),
                          rrsig_rdata_(createRdata(
@@ -167,8 +165,8 @@ public:
 
 // Used across more classes and scopes. But it's just uninteresting
 // constant.
-const Name &dummyName2() {
-    static Name result("example.com");
+const Name& dummyName2() {
+    static const Name result("example.com");
     return (result);
 }
 
@@ -329,9 +327,9 @@ public:
                            boost::bind(renderNameField, &renderer,
                                        additionalRequired(rrtype), _1, _2),
                            boost::bind(renderDataField, &renderer, _1, _2));
-        while (reader.next() != RdataReader::RRSET_BOUNDARY) { }
+        while (reader.next() != RdataReader::RRSET_BOUNDARY) {}
         renderer.writeName(dummyName2());
-        while (reader.nextSig() != RdataReader::RRSET_BOUNDARY) { }
+        while (reader.nextSig() != RdataReader::RRSET_BOUNDARY) {}
     }
 };
 
@@ -378,7 +376,8 @@ appendOrRenderData(vector<uint8_t>* where, MessageRenderer** renderer,
 class RewindAndDecode {
 private:
     static void writeName(MessageRenderer** renderer,
-                          const LabelSequence& labels, unsigned attributes)
+                          const LabelSequence& labels,
+                          RdataNameAttributes attributes)
     {
         (*renderer)->writeName(labels,
                                (attributes & NAMEATTR_COMPRESSIBLE) != 0);
@@ -428,13 +427,13 @@ public:
                            boost::bind(renderDataField, &renderer, _1, _2));
         size_t actual_count = 0;
         while (reader.iterateRdata()) {
-            actual_count ++;
+            ++actual_count;
         }
         EXPECT_EQ(rdata_count, actual_count);
         actual_count = 0;
         renderer.writeName(dummyName2());
         while (reader.iterateSingleSig()) {
-            actual_count ++;
+            ++actual_count;
         }
         EXPECT_EQ(sig_count, actual_count);
     }
@@ -501,8 +500,8 @@ typedef ::testing::Types<ManualDecoderStyle,
     DecoderStyles;
 // Each decoder style must contain a decode() method. Such method is expected
 // to decode the passed data, first render the Rdata into the passed renderer,
-// then write the dummyName2() there and write the RRSig data after that. It may
-// do other checks too.
+// then write the dummyName2() there and write the RRSig data after that.
+// It may do other checks too.
 //
 // There are some slight differences to how to do the decoding, that's why we
 // have the typed test.



More information about the bind10-changes mailing list