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/tools/ndncatchunks3.cpp b/tools/ndncatchunks3.cpp
index 7b72614..59a75ad 100644
--- a/tools/ndncatchunks3.cpp
+++ b/tools/ndncatchunks3.cpp
@@ -26,12 +26,12 @@
   Consumer(const std::string& data_name,
            size_t pipe_size, size_t total_seg,
            int scope = -1, bool mustBeFresh = true)
-    : m_data_name (data_name)
-    , m_pipe_size (pipe_size)
-    , m_total_seg (total_seg)
-    , m_next_seg (0)
-    , m_total_size (0)
-    , m_output (false)
+    : m_data_name(data_name)
+    , m_pipe_size(pipe_size)
+    , m_total_seg(total_seg)
+    , m_next_seg(0)
+    , m_total_size(0)
+    , m_output(false)
     , m_scope(scope)
     , m_mustBeFresh(mustBeFresh)
   {
@@ -70,25 +70,25 @@
 {
   try
     {
-      for (int i = 0; i < m_pipe_size; i++)
-        {
+      for (size_t i = 0; i < m_pipe_size; i++)
+	{
           ndn::Interest interest(ndn::Name(m_data_name).appendSegment(m_next_seg++));
-          interest.setInterestLifetime(ndn::time::milliseconds(4000));
-          if (m_scope >= 0)
+	  interest.setInterestLifetime(ndn::time::milliseconds(4000));
+	  if (m_scope >= 0)
             interest.setScope(m_scope);
-          interest.setMustBeFresh(m_mustBeFresh);
+	  interest.setMustBeFresh(m_mustBeFresh);
 
-          m_face.expressInterest (interest,
-                                  ndn::bind(&Consumer::on_data, this, _1, _2),
-                                  ndn::bind(&Consumer::on_timeout, this, _1));
-        }
+	  m_face.expressInterest(interest,
+                                 ndn::bind(&Consumer::on_data, this, _1, _2),
+                                 ndn::bind(&Consumer::on_timeout, this, _1));
+	}
 
       // processEvents will block until the requested data received or timeout occurs
       m_face.processEvents();
     }
   catch (std::exception& e)
     {
-      std::cerr << "ERROR: " << e.what () << std::endl;
+      std::cerr << "ERROR: " << e.what() << std::endl;
     }
 }
 
@@ -103,7 +103,7 @@
       std::cout.write(reinterpret_cast<const char*>(content.value()), content.value_size());
     }
 
-  m_total_size += content.value_size ();
+  m_total_size += content.value_size();
 
   if (name[-1].toSegment() + 1 == m_total_seg)
     {
@@ -119,9 +119,9 @@
       interest.setInterestLifetime(ndn::time::milliseconds(4000));
       interest.setMustBeFresh(m_mustBeFresh);
 
-      m_face.expressInterest (interest,
-                              ndn::bind(&Consumer::on_data, this, _1, _2),
-                              ndn::bind(&Consumer::on_timeout, this, _1));
+      m_face.expressInterest(interest,
+                             ndn::bind(&Consumer::on_data, this, _1, _2),
+                             ndn::bind(&Consumer::on_timeout, this, _1));
     }
 }
 
@@ -153,25 +153,25 @@
   int opt;
   while ((opt = getopt(argc, argv, "op:c:")) != -1)
     {
-      switch (opt)
-        {
+      switch(opt)
+	{
         case 'p':
-          pipe_size = atoi (optarg);
-          if (pipe_size <= 0)
-            pipe_size = 1;
-          std::cerr << "main (): set pipe size = " << pipe_size << std::endl;
-          break;
-        case 'c':
-          total_seg = atoi (optarg);
-          if (total_seg <= 0)
-            total_seg = 1;
-          std::cerr << "main (): set total seg = " << total_seg << std::endl;
-          break;
-        case 'o':
-          output = true;
-          break;
+	  pipe_size = atoi(optarg);
+	  if (pipe_size <= 0)
+	    pipe_size = 1;
+	  std::cerr << "main(): set pipe size = " << pipe_size << std::endl;
+	  break;
+	case 'c':
+	  total_seg = atoi(optarg);
+	  if (total_seg <= 0)
+	    total_seg = 1;
+	  std::cerr << "main(): set total seg = " << total_seg << std::endl;
+	  break;
+	case 'o':
+	  output = true;
+	  break;
         default:
-          return usage(argv[0]);
+	  return usage(argv[0]);
         }
     }
 
@@ -185,12 +185,12 @@
       return usage(argv[0]);
     }
 
-  Consumer consumer (name, pipe_size, total_seg);
+  Consumer consumer(name, pipe_size, total_seg);
 
   if (output)
-    consumer.enable_output ();
+    consumer.enable_output();
 
-  consumer.run ();
+  consumer.run();
 
   return 0;
 }
diff --git a/tools/ndnputchunks3.cpp b/tools/ndnputchunks3.cpp
index 3822ae0..bb6435b 100644
--- a/tools/ndnputchunks3.cpp
+++ b/tools/ndnputchunks3.cpp
@@ -129,7 +129,7 @@
             {
               std::cerr << "ERROR: " << e.what() << std::endl;
               // and keep going
-              sleep (1);
+              sleep(1);
             }
         }
     }
diff --git a/tools/ndnsec-cert-dump.hpp b/tools/ndnsec-cert-dump.hpp
index cbafc61..2adca8d 100644
--- a/tools/ndnsec-cert-dump.hpp
+++ b/tools/ndnsec-cert-dump.hpp
@@ -20,13 +20,13 @@
   bool isKeyName = false;
   bool isIdentityName = false;
   bool isCertName = true;
-  bool isFileName = false;
+  // bool isFileName = false;
   bool isPretty = false;
   bool isStdOut = true;
   bool isRepoOut = false;
   std::string repoHost = "127.0.0.1";
   std::string repoPort = "7376";
-  bool isDnsOut = false;
+  // bool isDnsOut = false;
 
   po::options_description desc("General Usage\n  ndnsec cert-dump [-h] [-p] [-d] [-r [-H repo-host] [-P repor-port] ] [-i|k|f] name\nGeneral options");
   desc.add_options()
@@ -38,7 +38,7 @@
     ("repo-output,r", "optional, if specified, certificate is dumped (published) to repo")
     ("repo-host,H", po::value<std::string>(&repoHost)->default_value("localhost"), "optional, the repo host if repo-output is specified")
     ("repo-port,P", po::value<std::string>(&repoPort)->default_value("7376"), "optional, the repo port if repo-output is specified")
-    ("dns-output,d", "optional, if specified, certificate is dumped (published) to DNS")
+    // ("dns-output,d", "optional, if specified, certificate is dumped (published) to DNS")
     ("name,n", po::value<std::string>(&name), "certificate name, for example, /ndn/edu/ucla/KEY/cs/alice/ksk-1234567890/ID-CERT/%FD%FF%FF%FF%FF%FF%FF%FF")
     ;
 
@@ -75,7 +75,7 @@
   else if (vm.count("file"))
     {
       isCertName = false;
-      isFileName = true;
+      // isFileName = true;
     }    
     
   if (vm.count("pretty"))
@@ -88,7 +88,7 @@
     }
   else if(vm.count("dns-output"))
     {
-      isDnsOut = true;
+      // isDnsOut = true;
       isStdOut = false;
       std::cerr << "Error: DNS output is not supported yet!" << std::endl;
       return 1;
diff --git a/tools/ndnsec-cert-gen.hpp b/tools/ndnsec-cert-gen.hpp
index 8b6e460..363dd57 100644
--- a/tools/ndnsec-cert-gen.hpp
+++ b/tools/ndnsec-cert-gen.hpp
@@ -19,8 +19,6 @@
   using namespace ndn;
   namespace po = boost::program_options;
 
-  typedef boost::posix_time::ptime Time;
-  
   std::string notBeforeStr;
   std::string notAfterStr;
   std::string sName;
@@ -199,7 +197,7 @@
           certificate.setNotAfter(notAfter);
           certificate.setPublicKeyInfo(selfSignedCertificate->getPublicKeyInfo());
           certificate.addSubjectDescription(subDescryptName);
-          for(int i = 0; i < otherSubDescrypt.size(); i++)
+          for (size_t i = 0; i < otherSubDescrypt.size(); i++)
             certificate.addSubjectDescription(otherSubDescrypt[i]);
           certificate.encode();
 
diff --git a/tools/ndnsec-cert-install.hpp b/tools/ndnsec-cert-install.hpp
index 1d3347f..12c036c 100644
--- a/tools/ndnsec-cert-install.hpp
+++ b/tools/ndnsec-cert-install.hpp
@@ -95,7 +95,7 @@
   bool systemDefault = true;
   bool identityDefault = false;
   bool keyDefault = false;
-  bool noDefault = false;
+  // bool noDefault = false;
   bool any = false;
 
   po::options_description desc("General Usage\n  ndnsec cert-install [-h] [-I|K|N] cert-file\nGeneral options");
@@ -148,7 +148,7 @@
     }
   else if (vm.count("no-default"))
     {
-      noDefault = true;
+      // noDefault = true;
       systemDefault = false;
     }
 
diff --git a/tools/ndnsec-delete.hpp b/tools/ndnsec-delete.hpp
index bced204..2536344 100644
--- a/tools/ndnsec-delete.hpp
+++ b/tools/ndnsec-delete.hpp
@@ -16,7 +16,7 @@
   using namespace ndn;
   namespace po = boost::program_options;
 
-  bool deleteId = true;
+  // bool deleteId = true;
   bool deleteKey = false;
   bool deleteCert = false;
   std::string name;
@@ -55,12 +55,12 @@
   if(vm.count("delete_cert"))
     {
       deleteCert = true;
-      deleteId = false;
+      // deleteId = false;
     }
   else if(vm.count("delete_key"))
     {
       deleteKey = true;
-      deleteId = false;
+      // deleteId = false;
     }
   
   try
diff --git a/tools/ndnsec-list.hpp b/tools/ndnsec-list.hpp
index b9724d6..3ebe2ca 100644
--- a/tools/ndnsec-list.hpp
+++ b/tools/ndnsec-list.hpp
@@ -56,11 +56,11 @@
         {
           std::vector<Name> defaultList;
           keyChain.getAllIdentities(defaultList, true);
-          for(int i = 0; i < defaultList.size(); i++)
+          for(size_t i = 0; i < defaultList.size(); i++)
             std::cout << "* " << defaultList[i] << std::endl;
           std::vector<Name> otherList;
           keyChain.getAllIdentities(otherList, false);
-          for(int i = 0; i < otherList.size(); i++)
+          for(size_t i = 0; i < otherList.size(); i++)
             std::cout << "  " << otherList[i] << std::endl;
           return 0;
         }
@@ -68,31 +68,31 @@
         {
           std::vector<Name> defaultIdList;
           keyChain.getAllIdentities(defaultIdList, true);
-          for(int i = 0; i < defaultIdList.size(); i++)
+          for(size_t i = 0; i < defaultIdList.size(); i++)
             {
               std::cout << "* " << defaultIdList[i] << std::endl;
               std::vector<Name> defaultKeyList;
               keyChain.getAllKeyNamesOfIdentity(defaultIdList[i], defaultKeyList, true);
-              for(int j = 0; j < defaultKeyList.size(); j++)
+              for(size_t j = 0; j < defaultKeyList.size(); j++)
                 std::cout << "  +->* " << defaultKeyList[j] << std::endl;
               std::vector<Name> otherKeyList;
               keyChain.getAllKeyNamesOfIdentity(defaultIdList[i], otherKeyList, false);
-              for(int j = 0; j < otherKeyList.size(); j++)
+              for(size_t j = 0; j < otherKeyList.size(); j++)
                 std::cout << "  +->  " << otherKeyList[j] << std::endl;
               std::cout << std::endl;
             }
           std::vector<Name> otherIdList;
           keyChain.getAllIdentities(otherIdList, false);
-          for(int i = 0; i < otherIdList.size(); i++)
+          for(size_t i = 0; i < otherIdList.size(); i++)
             {
               std::cout << "  " << otherIdList[i] << std::endl;
               std::vector<Name> defaultKeyList;
               keyChain.getAllKeyNamesOfIdentity(otherIdList[i], defaultKeyList, true);
-              for(int j = 0; j < defaultKeyList.size(); j++)
+              for(size_t j = 0; j < defaultKeyList.size(); j++)
                 std::cout << "  +->* " << defaultKeyList[j] << std::endl;
               std::vector<Name> otherKeyList;
               keyChain.getAllKeyNamesOfIdentity(otherIdList[i], otherKeyList, false);
-              for(int j = 0; j < otherKeyList.size(); j++)
+              for(size_t j = 0; j < otherKeyList.size(); j++)
                 std::cout << "  +->  " << otherKeyList[j] << std::endl;
               std::cout << std::endl;
             }
@@ -102,35 +102,35 @@
         {
           std::vector<Name> defaultIdList;
           keyChain.getAllIdentities(defaultIdList, true);
-          for(int i = 0; i < defaultIdList.size(); i++)
+          for(size_t i = 0; i < defaultIdList.size(); i++)
             {
               std::cout << "* " << defaultIdList[i] << std::endl;
               std::vector<Name> defaultKeyList;
               keyChain.getAllKeyNamesOfIdentity(defaultIdList[i], defaultKeyList, true);
-              for(int j = 0; j < defaultKeyList.size(); j++)
+              for(size_t j = 0; j < defaultKeyList.size(); j++)
                 {
                   std::cout << "  +->* " << defaultKeyList[j] << std::endl;
                   std::vector<Name> defaultCertList;
                   keyChain.getAllCertificateNamesOfKey(defaultKeyList[j], defaultCertList, true);
-                  for(int k = 0; k < defaultCertList.size(); k++)
+                  for(size_t k = 0; k < defaultCertList.size(); k++)
                     std::cout << "       +->* " << defaultCertList[k] << std::endl;
                   std::vector<Name> otherCertList;
                   keyChain.getAllCertificateNamesOfKey(defaultKeyList[j], otherCertList, false);
-                  for(int k = 0; k < otherCertList.size(); k++)
+                  for(size_t k = 0; k < otherCertList.size(); k++)
                     std::cout << "       +->  " << otherCertList[k] << std::endl;
                 }
               std::vector<Name> otherKeyList;
               keyChain.getAllKeyNamesOfIdentity(defaultIdList[i], otherKeyList, false);
-              for(int j = 0; j < otherKeyList.size(); j++)
+              for(size_t j = 0; j < otherKeyList.size(); j++)
                 {
                   std::cout << "  +->  " << otherKeyList[j] << std::endl;
                   std::vector<Name> defaultCertList;
                   keyChain.getAllCertificateNamesOfKey(otherKeyList[j], defaultCertList, true);
-                  for(int k = 0; k < defaultCertList.size(); k++)
+                  for(size_t k = 0; k < defaultCertList.size(); k++)
                     std::cout << "       +->* " << defaultCertList[k] << std::endl;
                   std::vector<Name> otherCertList;
                   keyChain.getAllCertificateNamesOfKey(otherKeyList[j], otherCertList, false);
-                  for(int k = 0; k < otherCertList.size(); k++)
+                  for(size_t k = 0; k < otherCertList.size(); k++)
                     std::cout << "       +->  " << otherCertList[k] << std::endl;
                 }
             
@@ -138,35 +138,35 @@
             }
           std::vector<Name> otherIdList;
           keyChain.getAllIdentities(otherIdList, false);
-          for(int i = 0; i < otherIdList.size(); i++)
+          for(size_t i = 0; i < otherIdList.size(); i++)
             {
               std::cout << "  " << otherIdList[i] << std::endl;
               std::vector<Name> defaultKeyList;
               keyChain.getAllKeyNamesOfIdentity(otherIdList[i], defaultKeyList, true);
-              for(int j = 0; j < defaultKeyList.size(); j++)
+              for(size_t j = 0; j < defaultKeyList.size(); j++)
                 {
                   std::cout << "  +->* " << defaultKeyList[j] << std::endl;
                   std::vector<Name> defaultCertList;
                   keyChain.getAllCertificateNamesOfKey(defaultKeyList[j], defaultCertList, true);
-                  for(int k = 0; k < defaultCertList.size(); k++)
+                  for(size_t k = 0; k < defaultCertList.size(); k++)
                     std::cout << "       +->* " << defaultCertList[k] << std::endl;
                   std::vector<Name> otherCertList;
                   keyChain.getAllCertificateNamesOfKey(defaultKeyList[j], otherCertList, false);
-                  for(int k = 0; k < otherCertList.size(); k++)
+                  for(size_t k = 0; k < otherCertList.size(); k++)
                     std::cout << "       +->  " << otherCertList[k] << std::endl;
                 }
               std::vector<Name> otherKeyList;
               keyChain.getAllKeyNamesOfIdentity(otherIdList[i], otherKeyList, false);
-              for(int j = 0; j < otherKeyList.size(); j++)
+              for(size_t j = 0; j < otherKeyList.size(); j++)
                 {
                   std::cout << "  +->  " << otherKeyList[j] << std::endl;
                   std::vector<Name> defaultCertList;
                   keyChain.getAllCertificateNamesOfKey(otherKeyList[j], defaultCertList, true);
-                  for(int k = 0; k < defaultCertList.size(); k++)
+                  for(size_t k = 0; k < defaultCertList.size(); k++)
                     std::cout << "       +->* " << defaultCertList[k] << std::endl;
                   std::vector<Name> otherCertList;
                   keyChain.getAllCertificateNamesOfKey(otherKeyList[j], otherCertList, false);
-                  for(int k = 0; k < otherCertList.size(); k++)
+                  for(size_t k = 0; k < otherCertList.size(); k++)
                     std::cout << "       +->  " << otherCertList[k] << std::endl;
                 }
               std::cout << std::endl;