src: Enabling -Werror in debug mode and some style updates
Several important warnings are still getting suppressed, because of
CryptoPP library
Change-Id: I8fb3d938544ecc38c65529262504dc753124bafd
diff --git a/src/util/regex/regex-backref-matcher.hpp b/src/util/regex/regex-backref-matcher.hpp
index 5ae5f35..e2eabe8 100644
--- a/src/util/regex/regex-backref-matcher.hpp
+++ b/src/util/regex/regex-backref-matcher.hpp
@@ -30,9 +30,6 @@
protected:
virtual void
compile();
-
-private:
- int m_refNum;
};
} // namespace ndn
diff --git a/src/util/regex/regex-component-matcher.hpp b/src/util/regex/regex-component-matcher.hpp
index b102316..50cb8de 100644
--- a/src/util/regex/regex-component-matcher.hpp
+++ b/src/util/regex/regex-component-matcher.hpp
@@ -72,7 +72,7 @@
m_pseudoMatcher.clear();
m_pseudoMatcher.push_back(ptr_lib::make_shared<RegexPseudoMatcher>());
- for (int i = 1; i < m_componentRegex.mark_count(); i++)
+ for (size_t i = 1; i < m_componentRegex.mark_count(); i++)
{
ptr_lib::shared_ptr<RegexPseudoMatcher> pMatcher = ptr_lib::make_shared<RegexPseudoMatcher>();
m_pseudoMatcher.push_back(pMatcher);
@@ -102,7 +102,7 @@
std::string targetStr = name.get(offset).toEscapedString();
if(boost::regex_match(targetStr, subResult, m_componentRegex))
{
- for (int i = 1; i < m_componentRegex.mark_count(); i++)
+ for (size_t i = 1; i < m_componentRegex.mark_count(); i++)
{
m_pseudoMatcher[i]->resetMatchResult();
m_pseudoMatcher[i]->setMatchResult(subResult[i]);
diff --git a/src/util/regex/regex-component-set-matcher.hpp b/src/util/regex/regex-component-set-matcher.hpp
index ffb4c6d..857c59e 100644
--- a/src/util/regex/regex-component-set-matcher.hpp
+++ b/src/util/regex/regex-component-set-matcher.hpp
@@ -107,9 +107,9 @@
inline void
RegexComponentSetMatcher::compileSingleComponent()
{
- int end = extractComponent(1);
+ size_t end = extractComponent(1);
- if(m_expr.size() != end)
+ if (m_expr.size() != end)
{
throw RegexMatcher::Error(std::string("Error: RegexComponentSetMatcher.compileSingleComponent: ")
+ m_expr);
diff --git a/src/util/regex/regex-matcher.hpp b/src/util/regex/regex-matcher.hpp
index baa8bf3..0d34311 100644
--- a/src/util/regex/regex-matcher.hpp
+++ b/src/util/regex/regex-matcher.hpp
@@ -66,7 +66,7 @@
private:
bool
- recursiveMatch(const int& mId, const Name& name, const int& offset, const int& len);
+ recursiveMatch(size_t mId, const Name& name, size_t offset, size_t len);
protected:
@@ -124,7 +124,7 @@
}
inline bool
-RegexMatcher::recursiveMatch(const int& mId, const Name& name, const int& offset, const int& len)
+RegexMatcher::recursiveMatch(size_t mId, const Name& name, size_t offset, size_t len)
{
// _LOG_TRACE ("Enter RegexMatcher::recursiveMatch");
diff --git a/src/util/regex/regex-pattern-list-matcher.hpp b/src/util/regex/regex-pattern-list-matcher.hpp
index 84b5c46..3ae74f1 100644
--- a/src/util/regex/regex-pattern-list-matcher.hpp
+++ b/src/util/regex/regex-pattern-list-matcher.hpp
@@ -32,10 +32,10 @@
extractPattern(int index, int* next);
int
- extractSubPattern(const char left, const char right, int index);
+ extractSubPattern(const char left, const char right, size_t index);
int
- extractRepetition(int index);
+ extractRepetition(size_t index);
private:
@@ -121,10 +121,10 @@
}
inline int
-RegexPatternListMatcher::extractSubPattern(const char left, const char right, int index)
+RegexPatternListMatcher::extractSubPattern(const char left, const char right, size_t index)
{
- int lcount = 1;
- int rcount = 0;
+ size_t lcount = 1;
+ size_t rcount = 0;
while(lcount > rcount){
@@ -143,9 +143,9 @@
}
inline int
-RegexPatternListMatcher::extractRepetition(int index)
+RegexPatternListMatcher::extractRepetition(size_t index)
{
- int exprSize = m_expr.size();
+ size_t exprSize = m_expr.size();
if(index == exprSize)
return index;
diff --git a/src/util/regex/regex-top-matcher.cpp b/src/util/regex/regex-top-matcher.cpp
index 38f1a5a..d3b8271 100644
--- a/src/util/regex/regex-top-matcher.cpp
+++ b/src/util/regex/regex-top-matcher.cpp
@@ -95,8 +95,8 @@
else
expand = m_expand;
- int offset = 0;
- while(offset < expand.size())
+ size_t offset = 0;
+ while (offset < expand.size())
{
std::string item = getItemFromExpand(expand, offset);
if(item[0] == '<')
@@ -129,9 +129,9 @@
}
std::string
-RegexTopMatcher::getItemFromExpand(const std::string& expand, int & offset)
+RegexTopMatcher::getItemFromExpand(const std::string& expand, size_t& offset)
{
- int begin = offset;
+ size_t begin = offset;
if(expand[offset] == '\\')
{
@@ -155,8 +155,8 @@
if(offset >= expand.size())
throw RegexMatcher::Error("wrong format of expand string!");
- int left = 1;
- int right = 0;
+ size_t left = 1;
+ size_t right = 0;
while(right < left)
{
if(expand[offset] == '<')
@@ -196,7 +196,7 @@
RegexTopMatcher::convertSpecialChar(const std::string& str)
{
std::string newStr;
- for(int i = 0; i < str.size(); i++)
+ for(size_t i = 0; i < str.size(); i++)
{
char c = str[i];
switch(c)
diff --git a/src/util/regex/regex-top-matcher.hpp b/src/util/regex/regex-top-matcher.hpp
index fc4a0df..4d9c01e 100644
--- a/src/util/regex/regex-top-matcher.hpp
+++ b/src/util/regex/regex-top-matcher.hpp
@@ -43,7 +43,7 @@
private:
std::string
- getItemFromExpand(const std::string& expand, int & offset);
+ getItemFromExpand(const std::string& expand, size_t& offset);
static std::string
convertSpecialChar(const std::string& str);
diff --git a/src/util/scheduler.cpp b/src/util/scheduler.cpp
index 377800f..fc6492f 100644
--- a/src/util/scheduler.cpp
+++ b/src/util/scheduler.cpp
@@ -76,8 +76,7 @@
Scheduler::Scheduler(boost::asio::io_service& ioService)
- : m_ioService(ioService)
- , m_scheduledEvent(m_events.end())
+ : m_scheduledEvent(m_events.end())
, m_deadlineTimer(ioService)
, m_isEventExecuting(false)
{
diff --git a/src/util/scheduler.hpp b/src/util/scheduler.hpp
index b7364ce..cc8bcce 100644
--- a/src/util/scheduler.hpp
+++ b/src/util/scheduler.hpp
@@ -56,8 +56,6 @@
onEvent(const boost::system::error_code& code);
private:
- boost::asio::io_service& m_ioService;
-
struct EventInfo
{
EventInfo(const time::nanoseconds& after,
diff --git a/src/util/string-helper.hpp b/src/util/string-helper.hpp
index 14f499e..9e2329c 100644
--- a/src/util/string-helper.hpp
+++ b/src/util/string-helper.hpp
@@ -23,7 +23,7 @@
inline std::string
toHex(const uint8_t* array, size_t arraySize)
{
- if (!&array)
+ if (array == 0 || arraySize == 0)
return "";
std::ostringstream result;