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');
diff --git a/include/login_routes.hpp b/include/login_routes.hpp
index 1087b0b..abcdaee 100644
--- a/include/login_routes.hpp
+++ b/include/login_routes.hpp
@@ -242,7 +242,7 @@
.methods(boost::beast::http::verb::post)(
[](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- auto& session = req.session;
+ const auto& session = req.session;
if (session != nullptr)
{
asyncResp->res.jsonValue = {
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index 1213758..431dd84 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -25,15 +25,11 @@
// Trust chain related errors.`
inline bool isTrustChainError(int errnum)
{
- if ((errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ||
- (errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) ||
- (errnum == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY) ||
- (errnum == X509_V_ERR_CERT_UNTRUSTED) ||
- (errnum == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE))
- {
- return true;
- }
- return false;
+ return (errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) ||
+ (errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) ||
+ (errnum == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY) ||
+ (errnum == X509_V_ERR_CERT_UNTRUSTED) ||
+ (errnum == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE);
}
inline bool validateCertificate(X509* const cert)