From: Aki Tuomi Date: Tue, 1 Sep 2015 08:47:30 +0000 (+0300) Subject: Use std::distance in dnsname, fix #2721 X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~65^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6a67b97c228b40c33775bfb819866e95f7493af;p=pdns Use std::distance in dnsname, fix #2721 --- diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index d9bf435fc..68d51e478 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -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= (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= static_cast(parent.d_storage.size()); us+=*us+1) { + if (std::distance(us,d_storage.cend()) == static_cast(parent.d_storage.size())) { auto p = parent.d_storage.cbegin(); for(; us != d_storage.cend(); ++us, ++p) { if(tolower(*p) != tolower(*us))