summaryrefslogtreecommitdiff
path: root/include/json_html_serializer.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-01-25 22:26:16 +0300
committerEd Tanous <ed@tanous.net>2022-03-12 04:35:05 +0300
commit55f79e6fe156505cdaddd521212a29b2a977193a (patch)
tree968c1c72b622c20defd635f406850af51eb2bfae /include/json_html_serializer.hpp
parent1b829889db64dd738660e62de633f1c028b3444c (diff)
downloadbmcweb-55f79e6fe156505cdaddd521212a29b2a977193a.tar.xz
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
Diffstat (limited to 'include/json_html_serializer.hpp')
-rw-r--r--include/json_html_serializer.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/json_html_serializer.hpp b/include/json_html_serializer.hpp
index 022ee13d16..320b5fd1af 100644
--- a/include/json_html_serializer.hpp
+++ b/include/json_html_serializer.hpp
@@ -325,7 +325,7 @@ void dumpInteger(std::string& out, NumberType number)
}
// 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 @@ void dumpInteger(std::string& out, NumberType number)
{
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 @@ inline void dumpfloat(std::string& out, double number,
return;
}
- const auto end =
+ const std::array<char, 64>::iterator end =
std::remove(numberbuffer.begin(), numberbuffer.begin() + len, ',');
std::fill(end, numberbuffer.end(), '\0');