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/encoding/tlv.hpp b/src/encoding/tlv.hpp
index 9cb1a0f..441bc99 100644
--- a/src/encoding/tlv.hpp
+++ b/src/encoding/tlv.hpp
@@ -195,7 +195,7 @@
       if (end - begin < 2)
         return false;
 
-      uint16_t value = *reinterpret_cast<const uint16_t*>(&*begin); // kind of dangerous... but should be efficient
+      uint16_t value = *reinterpret_cast<const uint16_t*>(&*begin);
       begin += 2;
       number = be16toh(value);
     }
@@ -204,7 +204,7 @@
       if (end - begin < 4)
         return false;
 
-      uint32_t value = *reinterpret_cast<const uint32_t*>(&*begin); // kind of dangerous... but should be efficient
+      uint32_t value = *reinterpret_cast<const uint32_t*>(&*begin);
       begin += 4;
       number = be32toh(value);
     }
@@ -227,8 +227,8 @@
 readType(InputIterator& begin, const InputIterator& end, uint32_t& type)
 {
   uint64_t number;
-  bool ok = readVarNumber(begin, end, number);
-  if (number > std::numeric_limits<uint32_t>::max())
+  bool isOk = readVarNumber(begin, end, number);
+  if (!isOk || number > std::numeric_limits<uint32_t>::max())
     {
       return false;
     }
@@ -255,7 +255,7 @@
       if (end - begin < 2)
         throw Error("Insufficient data during TLV processing");
 
-      uint16_t value = *reinterpret_cast<const uint16_t*>(&*begin); // kind of dangerous... but should be efficient
+      uint16_t value = *reinterpret_cast<const uint16_t*>(&*begin);
       begin += 2;
       return be16toh(value);
     }
@@ -264,7 +264,7 @@
       if (end - begin < 4)
         throw Error("Insufficient data during TLV processing");
 
-      uint32_t value = *reinterpret_cast<const uint32_t*>(&*begin); // kind of dangerous... but should be efficient
+      uint32_t value = *reinterpret_cast<const uint32_t*>(&*begin);
       begin += 4;
       return be32toh(value);
     }
@@ -423,7 +423,7 @@
       if (end - begin < 2)
         throw Error("Insufficient data during TLV processing");
 
-      uint16_t value = *reinterpret_cast<const uint16_t*>(&*begin); // kind of dangerous... but should be efficient
+      uint16_t value = *reinterpret_cast<const uint16_t*>(&*begin);
       begin += 2;
       return be16toh(value);
     }
@@ -432,7 +432,7 @@
       if (end - begin < 4)
         throw Error("Insufficient data during TLV processing");
 
-      uint32_t value = *reinterpret_cast<const uint32_t*>(&*begin); // kind of dangerous... but should be efficient
+      uint32_t value = *reinterpret_cast<const uint32_t*>(&*begin);
       begin += 4;
       return be32toh(value);
     }