src: fix -Wrange-loop-construct warning with clang 10

Change-Id: Ife00440ffa456c6ad2119fc656a34681327e0ab3
This commit is contained in:
Davide Pesavento committed 2020-05-01 02:48:34 -04:00
1 parent f6be8e37f6
commit 4b9d30f8e2
2 files changed
+15 -22

No files matched your search

+8 -11
View File
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
/*
* Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
@@ -24,8 +24,6 @@
#include "utility/name-helper.hpp"
#include "update/prefix-update-processor.hpp"
#include <boost/cstdint.hpp>
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/net/face-uri.hpp>
@@ -473,19 +471,19 @@ ConfFileProcessor::processConfSectionNeighbors(const ConfigSection& section)
std::string uriString = CommandAttriTree.get<std::string>("face-uri");
ndn::FaceUri faceUri;
if (! faceUri.parse(uriString)) {
std::cerr << "Parsing failed!" << std::endl;
if (!faceUri.parse(uriString)) {
std::cerr << "face-uri parsing failed" << std::endl;
return false;
}
bool failedToCanonize = false;
faceUri.canonize([&faceUri] (ndn::FaceUri canonicalUri) {
faceUri.canonize([&faceUri] (const auto& canonicalUri) {
faceUri = canonicalUri;
},
[&faceUri, &failedToCanonize] (const std::string& reason) {
[&faceUri, &failedToCanonize] (const auto& reason) {
failedToCanonize = true;
std::cerr << "Could not canonize URI: " << faceUri
<< "because: " << reason << std::endl;
std::cerr << "Could not canonize URI: '" << faceUri
<< "' because: " << reason << std::endl;
},
m_io,
TIME_ALLOWED_FOR_CANONIZATION);
@@ -496,8 +494,7 @@ ConfFileProcessor::processConfSectionNeighbors(const ConfigSection& section)
return false;
}
double linkCost = CommandAttriTree.get<double>("link-cost",
Adjacent::DEFAULT_LINK_COST);
double linkCost = CommandAttriTree.get<double>("link-cost", Adjacent::DEFAULT_LINK_COST);
ndn::Name neighborName(name);
if (!neighborName.empty()) {
Adjacent adj(name, faceUri, linkCost, Adjacent::STATUS_INACTIVE, 0, 0);
+7 -11
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2018, The University of Memphis,
/*
* Copyright (c) 2014-2020, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -43,8 +43,7 @@ NamePrefixTableEntry::generateNhlfromRteList()
}
uint64_t
NamePrefixTableEntry::removeRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry>
entryPtr)
NamePrefixTableEntry::removeRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry> entryPtr)
{
auto iterator = std::find(m_rteList.begin(), m_rteList.end(), entryPtr);
@@ -62,8 +61,7 @@ NamePrefixTableEntry::removeRoutingTableEntry(std::shared_ptr<RoutingTablePoolEn
}
void
NamePrefixTableEntry::addRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry>
entryPtr)
NamePrefixTableEntry::addRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry> entryPtr)
{
auto iterator = std::find(m_rteList.begin(), m_rteList.end(), entryPtr);
@@ -93,24 +91,22 @@ NamePrefixTableEntry::writeLog()
bool
operator==(const NamePrefixTableEntry& lhs, const NamePrefixTableEntry& rhs)
{
return (lhs.getNamePrefix() == rhs.getNamePrefix());
return lhs.getNamePrefix() == rhs.getNamePrefix();
}
bool
operator==(const NamePrefixTableEntry& lhs, const ndn::Name& rhs)
{
return (lhs.getNamePrefix() == rhs);
return lhs.getNamePrefix() == rhs;
}
std::ostream&
operator<<(std::ostream& os, const NamePrefixTableEntry& entry)
{
os << "Name: " << entry.getNamePrefix() << "\n";
for (const std::shared_ptr<RoutingTablePoolEntry> entryPtr : entry.getRteList()) {
for (const auto& entryPtr : entry.getRteList()) {
os << "Destination: " << entryPtr->getDestination() << "\n";
}
return os;
}