From: Fred Morcos Date: Fri, 6 May 2022 09:53:55 +0000 (+0200) Subject: Lint fix when iterating over IP parts in reverse X-Git-Tag: auth-4.8.0-alpha0~63^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98a0d6c696d792ad94871d4c7aa89a4589db852f;p=thirdparty%2Fpdns.git Lint fix when iterating over IP parts in reverse --- diff --git a/pdns/reczones.cc b/pdns/reczones.cc index 599f69648b..b3f649ea0d 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -237,15 +237,15 @@ static void makeNameToIPZone(const std::shared_ptr& newMap static void makeIPToNamesZone(const std::shared_ptr& newMap, const vector& parts, Logr::log_t log) { string address = parts[0]; - vector ipparts; - stringtok(ipparts, address, "."); + vector ipParts; + stringtok(ipParts, address, "."); SyncRes::AuthDomain ad; ad.d_rdForward = false; DNSRecord dr; - for (int n = ipparts.size() - 1; n >= 0; --n) { - dr.d_name.appendRawLabel(ipparts[n]); + for (auto part = ipParts.rbegin(); part != ipParts.rend(); ++part) { + dr.d_name.appendRawLabel(*part); } dr.d_name.appendRawLabel("in-addr"); dr.d_name.appendRawLabel("arpa"); @@ -263,7 +263,7 @@ static void makeIPToNamesZone(const std::shared_ptr& newMa ad.d_records.insert(dr); dr.d_type = QType::PTR; - if (ipparts.size() == 4) { // otherwise this is a partial zone + if (ipParts.size() == 4) { // otherwise this is a partial zone for (unsigned int n = 1; n < parts.size(); ++n) { dr.d_content = DNSRecordContent::mastermake(QType::PTR, 1, DNSName(parts[n]).toString()); // XXX FIXME DNSNAME PAIN CAN THIS BE RIGHT? ad.d_records.insert(dr); @@ -275,7 +275,7 @@ static void makeIPToNamesZone(const std::shared_ptr& newMa log->info(Logr::Warning, "Will not overwrite already loaded zone", "zone", Logging::Loggable(dr.d_name))); } else { - if (ipparts.size() == 4) { + if (ipParts.size() == 4) { SLOG(g_log << Logger::Warning << "Inserting reverse zone '" << dr.d_name << "' based on hosts file" << endl, log->info(Logr::Notice, "Inserting reverse zone based on hosts file", "zone", Logging::Loggable(dr.d_name))); }