BIND 10 trac2124, updated. 5a7c29f6d80ca982c4c48357af6833381268b590 [2124] some editorial fixes to test data comments

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Jul 27 07:34:16 UTC 2012


The branch, trac2124 has been updated
       via  5a7c29f6d80ca982c4c48357af6833381268b590 (commit)
       via  d2355e5f5b2bfc9dc85f0670bf28fc7d47433b1d (commit)
       via  a09cb3f049e97d207fed3345a97af0458f23a345 (commit)
      from  40175938620af9a6c5116ef93418874bc53c3b1e (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 5a7c29f6d80ca982c4c48357af6833381268b590
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Jul 27 00:33:58 2012 -0700

    [2124] some editorial fixes to test data comments

commit d2355e5f5b2bfc9dc85f0670bf28fc7d47433b1d
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Jul 27 00:27:05 2012 -0700

    [2124] prefer empty() over size() > 0 (see the previous commit)

commit a09cb3f049e97d207fed3345a97af0458f23a345
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Fri Jul 27 00:18:32 2012 -0700

    [2124] some suggested changes:
    - use !empty() instead of size() > 0.  for vectors there should be
      essentially no difference, but for other type of containers the former
      is generally better, and so I believe it's better to always follow that
      convention.
    - constify

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

Summary of changes:
 src/lib/dns/rdata/generic/sshfp_44.cc             |   15 ++++++++-------
 src/lib/dns/tests/testdata/rdata_sshfp_fromWire10 |    4 ++--
 src/lib/dns/tests/testdata/rdata_sshfp_fromWire11 |    2 +-
 3 files changed, 11 insertions(+), 10 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rdata/generic/sshfp_44.cc b/src/lib/dns/rdata/generic/sshfp_44.cc
index 7489f40..e87134b 100644
--- a/src/lib/dns/rdata/generic/sshfp_44.cc
+++ b/src/lib/dns/rdata/generic/sshfp_44.cc
@@ -109,7 +109,7 @@ SSHFP::toWire(OutputBuffer& buffer) const {
     buffer.writeUint8(algorithm_);
     buffer.writeUint8(fingerprint_type_);
 
-    if (fingerprint_.size() > 0) {
+    if (!fingerprint_.empty()) {
         buffer.writeData(&fingerprint_[0], fingerprint_.size());
     }
 }
@@ -119,7 +119,7 @@ SSHFP::toWire(AbstractMessageRenderer& renderer) const {
     renderer.writeUint8(algorithm_);
     renderer.writeUint8(fingerprint_type_);
 
-    if (fingerprint_.size() > 0) {
+    if (!fingerprint_.empty()) {
         renderer.writeData(&fingerprint_[0], fingerprint_.size());
     }
 }
@@ -128,7 +128,7 @@ string
 SSHFP::toText() const {
     return (lexical_cast<string>(static_cast<int>(algorithm_)) +
             " " + lexical_cast<string>(static_cast<int>(fingerprint_type_)) +
-            (fingerprint_.size() > 0 ? " " + encodeHex(fingerprint_) : ""));
+            (fingerprint_.empty() ? "" : " " + encodeHex(fingerprint_)));
 }
 
 int
@@ -150,14 +150,15 @@ SSHFP::compare(const Rdata& other) const {
         return (1);
     }
 
-    size_t this_len = fingerprint_.size();
-    size_t other_len = other_sshfp.fingerprint_.size();
-    size_t cmplen = min(this_len, other_len);
+    const size_t this_len = fingerprint_.size();
+    const size_t other_len = other_sshfp.fingerprint_.size();
+    const size_t cmplen = min(this_len, other_len);
     if (cmplen == 0) {
         return ((this_len == other_len)
                 ? 0 : (this_len < other_len) ? -1 : 1);
     }
-    int cmp = memcmp(&fingerprint_[0], &other_sshfp.fingerprint_[0], cmplen);
+    const int cmp = memcmp(&fingerprint_[0], &other_sshfp.fingerprint_[0],
+                           cmplen);
     if (cmp != 0) {
         return (cmp);
     } else {
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire10 b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire10
index 7e04a20..220e570 100644
--- a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire10
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire10
@@ -1,6 +1,6 @@
 # Test where fingerprint is missing
 
-# SSHFP RDATA, RDLEN=22
+# SSHFP RDATA, RDLEN=32
 0020
-# ALGORITHM=2 FINGERPRINT_TYPE=1 FINGERPRINT=123456789abcdef67890123456789abcdef67890
+# ALGORITHM=2 FINGERPRINT_TYPE=1 FINGERPRINT=(none)
 02 01
diff --git a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire11 b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire11
index 0756c83..a2f8636 100644
--- a/src/lib/dns/tests/testdata/rdata_sshfp_fromWire11
+++ b/src/lib/dns/tests/testdata/rdata_sshfp_fromWire11
@@ -1,4 +1,4 @@
 # Test where RDATA is completely missing
 
-# SSHFP RDATA, RDLEN=22
+# SSHFP RDATA, RDLEN=32
 0020



More information about the bind10-changes mailing list