Enable readability-avoid-const-params-in-decls
This check involves explicitly declaring variables const when they're
declared auto, which helps in readability, and makes it more clear that
the variables are const.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
diff --git a/http/common.hpp b/http/common.hpp
index 6f6b24c..01e90b2 100644
--- a/http/common.hpp
+++ b/http/common.hpp
@@ -48,7 +48,7 @@
std::cerr << i << ", ";
}
std::cerr << std::endl;
- for (auto& i : stringParams)
+ for (const std::string& i : stringParams)
{
std::cerr << i << ", ";
}
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 84f5c18..0b58e9b 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -99,8 +99,9 @@
adaptor.set_verify_mode(boost::asio::ssl::verify_peer);
std::string id = "bmcweb";
+ const char* cStr = id.c_str();
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
- auto* idC = reinterpret_cast<const unsigned char*>(id.c_str());
+ const auto* idC = reinterpret_cast<const unsigned char*>(cStr);
int ret = SSL_set_session_id_context(
adaptor.native_handle(), idC,
static_cast<unsigned int>(id.length()));
diff --git a/http/routing.hpp b/http/routing.hpp
index 9cd3d7b..9032b14 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -68,7 +68,7 @@
}
#endif
- size_t getMethods()
+ size_t getMethods() const
{
return methodsBitfield;
}
diff --git a/http/websocket.hpp b/http/websocket.hpp
index 74bce58..eadb276 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -34,11 +34,11 @@
Connection& operator=(const Connection&) = delete;
Connection& operator=(const Connection&&) = delete;
- virtual void sendBinary(const std::string_view msg) = 0;
+ virtual void sendBinary(std::string_view msg) = 0;
virtual void sendBinary(std::string&& msg) = 0;
- virtual void sendText(const std::string_view msg) = 0;
+ virtual void sendText(std::string_view msg) = 0;
virtual void sendText(std::string&& msg) = 0;
- virtual void close(const std::string_view msg = "quit") = 0;
+ virtual void close(std::string_view msg = "quit") = 0;
virtual boost::asio::io_context& getIoContext() = 0;
virtual ~Connection() = default;