Enable readability checks
clang-tidy readability checks are overall a good thing, and help us to
write consistent and readable code, even if it doesn't change the
result.
All changes done by the robot.
Tested: Code compiles, inspection only (changes made by robot)
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iee4a0c74a11eef9f158f0044eae675ebc518b549
diff --git a/include/json_html_serializer.hpp b/include/json_html_serializer.hpp
index 022ee13..320b5fd1 100644
--- a/include/json_html_serializer.hpp
+++ b/include/json_html_serializer.hpp
@@ -325,7 +325,7 @@
}
// use a pointer to fill the buffer
- auto bufferPtr = begin(numberbuffer);
+ auto* bufferPtr = begin(numberbuffer);
const bool isNegative = std::is_same<NumberType, int64_t>::value &&
!(number >= 0); // see issue #755
@@ -364,18 +364,23 @@
{
const auto digitsIndex = static_cast<unsigned>((absValue % 100));
absValue /= 100;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
*(--bufferPtr) = digitsTo99[digitsIndex][1];
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
*(--bufferPtr) = digitsTo99[digitsIndex][0];
}
if (absValue >= 10)
{
const auto digitsIndex = static_cast<unsigned>(absValue);
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
*(--bufferPtr) = digitsTo99[digitsIndex][1];
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
*(--bufferPtr) = digitsTo99[digitsIndex][0];
}
else
{
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
*(--bufferPtr) = static_cast<char>('0' + absValue);
}
@@ -418,7 +423,7 @@
return;
}
- const auto end =
+ const std::array<char, 64>::iterator end =
std::remove(numberbuffer.begin(), numberbuffer.begin() + len, ',');
std::fill(end, numberbuffer.end(), '\0');