src: fix -Wrange-loop-construct warning with clang 10
Change-Id: Ife00440ffa456c6ad2119fc656a34681327e0ab3
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index b893bf8..69a7881 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -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 @@
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 @@
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);
diff --git a/src/route/name-prefix-table-entry.cpp b/src/route/name-prefix-table-entry.cpp
index ac4c3ec..9890101 100644
--- a/src/route/name-prefix-table-entry.cpp
+++ b/src/route/name-prefix-table-entry.cpp
@@ -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 @@
}
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 @@
}
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 @@
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;
}