build: Enabling -Werror in debug mode and fixing discovered issues

Change-Id: I29685dcb9240a3e0c8d7eaf28c8bc2ae720e55a1
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 96d1ce7..4028ad5 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -317,6 +317,9 @@
           try
             {
               keepAliveInterval = i->second.get_value<size_t>();
+
+              /// \todo Make use of keepAliveInterval
+              (void)(keepAliveInterval);
             }
           catch (const std::exception& e)
             {
diff --git a/daemon/table/cs.cpp b/daemon/table/cs.cpp
index 0e0bb6a..bad684e 100644
--- a/daemon/table/cs.cpp
+++ b/daemon/table/cs.cpp
@@ -138,21 +138,19 @@
 
   NFD_LOG_DEBUG("Not a duplicate");
 
-  int randomLayer = pickRandomLayer();
+  size_t randomLayer = pickRandomLayer();
 
-  if (randomLayer > (m_skipList.size() - 1))
+  while ( m_skipList.size() < randomLayer + 1)
     {
-      while ( (m_skipList.size() - 1) < randomLayer)
-        {
-          SkipListLayer* newLayer = new SkipListLayer();
-          m_skipList.push_back(newLayer);
+      SkipListLayer* newLayer = new SkipListLayer();
+      m_skipList.push_back(newLayer);
 
-          updateTable[(m_skipList.size() - 1)] = newLayer->begin();
-        }
+      updateTable[(m_skipList.size() - 1)] = newLayer->begin();
     }
 
-  int layer = 0;
-  for (SkipList::iterator i = m_skipList.begin(); i != m_skipList.end() && layer <= randomLayer; ++i)
+  size_t layer = 0;
+  for (SkipList::iterator i = m_skipList.begin();
+       i != m_skipList.end() && layer <= randomLayer; ++i)
     {
       if (updateTable[layer] == (*i)->end() && !insertInFront)
         {
@@ -213,7 +211,7 @@
   return false;
 }
 
-int
+size_t
 Cs::pickRandomLayer() const
 {
   int layer = -1;
@@ -226,7 +224,7 @@
     }
   while ( (randomValue < SKIPLIST_PROBABILITY) && (layer < SKIPLIST_MAX_LAYERS) );
 
-  return layer;
+  return static_cast<size_t>(layer);
 }
 
 bool
@@ -572,7 +570,7 @@
 
       BOOST_ASSERT(digest->size() == last.value_size());
       BOOST_ASSERT(digest->size() == ndn::crypto::SHA256_DIGEST_SIZE);
-      
+
       if (std::memcmp(digest->buf(), last.value(), ndn::crypto::SHA256_DIGEST_SIZE) != 0)
         {
           NFD_LOG_DEBUG("violates implicit digest");
@@ -584,9 +582,9 @@
     {
       if (interest.getMinSuffixComponents() >= 0)
         {
-          int minDataNameLength = interest.getName().size() + interest.getMinSuffixComponents();
+          size_t minDataNameLength = interest.getName().size() + interest.getMinSuffixComponents();
 
-          bool isSatisfied = minDataNameLength <= entry->getName().size();
+          bool isSatisfied = (minDataNameLength <= entry->getName().size());
           if ( !isSatisfied )
             {
               NFD_LOG_DEBUG("violates minComponents");
@@ -596,9 +594,9 @@
 
       if (interest.getMaxSuffixComponents() >= 0)
         {
-          int maxDataNameLength = interest.getName().size() + interest.getMaxSuffixComponents();
+          size_t maxDataNameLength = interest.getName().size() + interest.getMaxSuffixComponents();
 
-          bool isSatisfied = maxDataNameLength >= entry->getName().size();
+          bool isSatisfied = (maxDataNameLength >= entry->getName().size());
           if ( !isSatisfied )
             {
               NFD_LOG_DEBUG("violates maxComponents");
diff --git a/daemon/table/cs.hpp b/daemon/table/cs.hpp
index e4c1ae6..aeaec38 100644
--- a/daemon/table/cs.hpp
+++ b/daemon/table/cs.hpp
@@ -85,7 +85,7 @@
    *  Reference: "Skip Lists: A Probabilistic Alternative to Balanced Trees" by W.Pugh
    *  \return{ returns random layer (number) in a skip list}
    */
-  int
+  size_t
   pickRandomLayer() const;
 
   /** \brief Inserts a new Content Store Entry in a skip list