]> granicus.if.org Git - pdns/commitdiff
Use std::distance in dnsname, fix #2721
authorAki Tuomi <cmouse@desteem.org>
Tue, 1 Sep 2015 08:47:30 +0000 (11:47 +0300)
committerAki Tuomi <cmouse@desteem.org>
Tue, 1 Sep 2015 08:47:30 +0000 (11:47 +0300)
pdns/dnsname.cc

index d9bf435fce5119905c7601777bf6f609aa2b32de..68d51e478dfac3de75ee70f01cf527f048f3ce6f 100644 (file)
@@ -112,8 +112,8 @@ bool DNSName::isPartOf(const DNSName& parent) const
     return false;
 
   // this is slightly complicated since we can't start from the end, since we can't see where a label begins/ends then
-  for(auto us=d_storage.cbegin(); us<d_storage.cend() && d_storage.cend()-us >= (unsigned int)parent.d_storage.size(); us+=*us+1) {
-    if (d_storage.cend()-us == (unsigned int)parent.d_storage.size()) {
+  for(auto us=d_storage.cbegin(); us<d_storage.cend() && std::distance(us,d_storage.cend()) >= static_cast<unsigned int>(parent.d_storage.size()); us+=*us+1) {
+    if (std::distance(us,d_storage.cend()) == static_cast<unsigned int>(parent.d_storage.size())) {
       auto p = parent.d_storage.cbegin();
       for(; us != d_storage.cend(); ++us, ++p) {
         if(tolower(*p) != tolower(*us))