From 8ce7db9ba907ad4e826c826af898e1864f25f7bb Mon Sep 17 00:00:00 2001 From: cflip Date: Mon, 19 Sep 2022 21:53:40 -0600 Subject: Add ClangTidy configuration and apply fixes --- src/ClientConnection.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ClientConnection.cpp') diff --git a/src/ClientConnection.cpp b/src/ClientConnection.cpp index 6a0670c..c434212 100644 --- a/src/ClientConnection.cpp +++ b/src/ClientConnection.cpp @@ -10,13 +10,13 @@ ClientConnection::ClientConnection(int socket) { } -HttpRequest ClientConnection::read_request() +HttpRequest ClientConnection::read_request() const { // TODO: Clean up this code to ensure it works with multiple lines // and not risk a buffer overflow. constexpr int BUFFER_SIZE = 4096; char buffer[BUFFER_SIZE + 1]; - int n; + int n = 0; memset(buffer, 0, BUFFER_SIZE); while ((n = read(m_socket_fd, buffer, BUFFER_SIZE - 1)) > 0) { @@ -29,7 +29,7 @@ HttpRequest ClientConnection::read_request() return HttpRequest(buffer); } -bool ClientConnection::send(const HttpResponse& response) +bool ClientConnection::send(const HttpResponse& response) const { if (!m_is_open) return false; -- cgit v1.2.3