Enable init checker
clang-tidy added cppcoreguidelines-init-variables as a check, which is
something we already enforce to some extent, but getting CI to enforce
it will help reviews move faster.
Tested: Code compiles. Noop changes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I7e10950de617b1d3262265572b1703f2e60b69d0
diff --git a/http/routing.hpp b/http/routing.hpp
index c8946e4..06f2a09 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -805,7 +805,7 @@
char c = reqUrl[pos];
if ((c >= '0' && c <= '9') || c == '+' || c == '-')
{
- char* eptr;
+ char* eptr = nullptr;
errno = 0;
long long int value =
std::strtoll(reqUrl.data() + pos, &eptr, 10);
@@ -828,7 +828,7 @@
char c = reqUrl[pos];
if ((c >= '0' && c <= '9') || c == '+')
{
- char* eptr;
+ char* eptr = nullptr;
errno = 0;
unsigned long long int value =
std::strtoull(reqUrl.data() + pos, &eptr, 10);
@@ -851,7 +851,7 @@
char c = reqUrl[pos];
if ((c >= '0' && c <= '9') || c == '+' || c == '-' || c == '.')
{
- char* eptr;
+ char* eptr = nullptr;
errno = 0;
double value = std::strtod(reqUrl.data() + pos, &eptr);
if (errno != ERANGE && eptr != reqUrl.data() + pos)
diff --git a/http/utility.hpp b/http/utility.hpp
index 374caea..74a35da 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -425,7 +425,7 @@
size_t i = 0;
while (i < size)
{
- size_t keyIndex;
+ size_t keyIndex = 0;
keyIndex = static_cast<size_t>(data[i] & 0xFC) >> 2;
*it++ = key[keyIndex];
@@ -513,10 +513,10 @@
for (size_t i = 0; i < inputLength; i++)
{
- char base64code0;
- char base64code1;
+ char base64code0 = 0;
+ char base64code1 = 0;
char base64code2 = 0; // initialized to 0 to suppress warnings
- char base64code3;
+ char base64code3 = 0;
base64code0 = getCodeValue(input[i]);
if (base64code0 == nop)