[svn] commit: r781 - /branches/jinmei-dnsrdata2/src/lib/dns/cpp/rdata.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Feb 10 09:48:05 UTC 2010


Author: jinmei
Date: Wed Feb 10 09:48:04 2010
New Revision: 781

Log:
fixed a bug in compareNames()

Modified:
    branches/jinmei-dnsrdata2/src/lib/dns/cpp/rdata.cc

Modified: branches/jinmei-dnsrdata2/src/lib/dns/cpp/rdata.cc
==============================================================================
--- branches/jinmei-dnsrdata2/src/lib/dns/cpp/rdata.cc (original)
+++ branches/jinmei-dnsrdata2/src/lib/dns/cpp/rdata.cc Wed Feb 10 09:48:04 2010
@@ -14,6 +14,7 @@
 
 // $Id$
 
+#include <algorithm>
 #include <cctype>
 #include <string>
 #include <sstream>
@@ -85,14 +86,14 @@
 {
     size_t len1 = n1.getLength();
     size_t len2 = n2.getLength();
-    size_t cmplen = (len1 < len2) ? len1 : len2;
+    size_t cmplen = min(len1, len2);
 
     for (size_t i = 0; i < cmplen; ++i) {
         uint8_t c1 = tolower(n1.at(i));
         uint8_t c2 = tolower(n2.at(i));
         if (c1 < c2) {
             return (-1);
-        } else if (c2 > c1) {
+        } else if (c1 > c2) {
             return (1);
         }
     }




More information about the bind10-changes mailing list