BIND 10 trac2977, updated. 67a39b06a802b161dd6c4c93892bf3309d30d892 [2977] Replaced inline protocol type check with cascaded check.

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jul 10 09:08:28 UTC 2013


The branch, trac2977 has been updated
       via  67a39b06a802b161dd6c4c93892bf3309d30d892 (commit)
      from  d406f5702264d689e6c1b7dd6c285b7d5ab06db0 (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 67a39b06a802b161dd6c4c93892bf3309d30d892
Author: Marcin Siodelski <marcin at isc.org>
Date:   Wed Jul 10 11:08:10 2013 +0200

    [2977] Replaced inline protocol type check with cascaded check.

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

Summary of changes:
 src/bin/d2/dns_client.cc |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/d2/dns_client.cc b/src/bin/d2/dns_client.cc
index 88562b9..a3bff81 100644
--- a/src/bin/d2/dns_client.cc
+++ b/src/bin/d2/dns_client.cc
@@ -91,10 +91,18 @@ DNSClientImpl::DNSClientImpl(D2UpdateMessagePtr& response_placeholder,
     // Given that we already eliminated the possibility that TCP is used, it
     // would be sufficient  to check that (proto != DNSClient::UDP). But, once
     // support TCP is added the check above will disappear and the extra check
-    // will be needed here anyway. Why not add it now?
-    if (proto_ != DNSClient::TCP && proto_ != DNSClient::UDP) {
-        isc_throw(isc::NotImplemented, "invalid transport protocol type '"
-                  << proto_ << "' specified for DNS Updates");
+    // will be needed here anyway.
+    // Note that cascaded check is used here instead of:
+    //   if (proto_ != DNSClient::TCP && proto_ != DNSClient::UDP)..
+    // because some versions of GCC compiler complain that check above would
+    // be always 'false' due to limited range of enumeration. In fact, it is
+    // possible to pass out of range integral value through enum and it should
+    // be caught here.
+    if (proto_ != DNSClient::TCP) {
+        if (proto_ != DNSClient::UDP) {
+            isc_throw(isc::NotImplemented, "invalid transport protocol type '"
+                      << proto_ << "' specified for DNS Updates");
+        }
     }
 
     if (!response_) {



More information about the bind10-changes mailing list