From e5a3d3fba1bcaf3ec6d430e32ef62e0c82223505 Mon Sep 17 00:00:00 2001 From: egecetin Date: Sun, 8 Dec 2024 12:40:54 +0300 Subject: [PATCH] last fixes --- src/telnet/TelnetServer.cpp | 3 ++- src/utils/ConfigParser.cpp | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/telnet/TelnetServer.cpp b/src/telnet/TelnetServer.cpp index 966d2506..103da4a2 100644 --- a/src/telnet/TelnetServer.cpp +++ b/src/telnet/TelnetServer.cpp @@ -475,7 +475,8 @@ void TelnetSession::update() // we've got to be careful here. Telnet client might send null characters for New Lines mid-data block. We need // to swap these out. recv is not null terminated, so its cool - std::replace_if(recvbuf.begin(), recvbuf.begin() + readBytes, [](char c) { return c == ASCII_NULL; }, ASCII_LF); + std::replace_if( + recvbuf.begin(), recvbuf.begin() + readBytes, [](char chr) { return chr == ASCII_NULL; }, ASCII_LF); // Add it to the received buffer m_buffer.append(recvbuf.data(), static_cast(readBytes)); diff --git a/src/utils/ConfigParser.cpp b/src/utils/ConfigParser.cpp index 1c701cb3..c3ec5e26 100644 --- a/src/utils/ConfigParser.cpp +++ b/src/utils/ConfigParser.cpp @@ -7,13 +7,16 @@ #include -template static std::string stringifyRapidjson(const T &obj) +namespace { - rapidjson::StringBuffer sbuffer; - rapidjson::Writer writer(sbuffer); - obj.Accept(writer); - return sbuffer.GetString(); -} + template std::string stringifyRapidjson(const T &obj) + { + rapidjson::StringBuffer sbuffer; + rapidjson::Writer writer(sbuffer); + obj.Accept(writer); + return sbuffer.GetString(); + } +} // namespace void ConfigParser::readJson() {