From 9414898753f0857e503d802dd5fce8ada0dc4f39 Mon Sep 17 00:00:00 2001 From: Tomenz Date: Tue, 29 Oct 2024 23:36:10 +0100 Subject: [PATCH] Compiler warnings removed. --- HttpFetch.cpp | 16 ++++++++-------- HttpFetch.h | 2 +- HttpServ.cpp | 2 +- SpawnProcess.cpp | 12 +++--------- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/HttpFetch.cpp b/HttpFetch.cpp index a7e9762..330d5d5 100644 --- a/HttpFetch.cpp +++ b/HttpFetch.cpp @@ -16,7 +16,7 @@ using namespace std::placeholders; vector vecProtokolls = { {"h2"}, {"http/1.1"} }; -HttpFetch::HttpFetch(function fnNotify, void* vpUserData) : m_pcClientCon(nullptr), m_sPort(80), m_UseSSL(false), m_uiStatus(0), m_bIsHttp2(false), m_bOutpHeader(false), m_bEndOfHeader(false), m_nContentLength(SIZE_MAX), m_nContentReceived(0), m_nChuncked(-1), m_nNextChunk(0), m_nChunkFooter(0), m_fnNotify(fnNotify) +HttpFetch::HttpFetch(function fnNotify, void* /*vpUserData*/) : m_pcClientCon(nullptr), m_sPort(80), m_UseSSL(false), m_uiStatus(0), m_bIsHttp2(false), m_bOutpHeader(false), m_bEndOfHeader(false), m_nContentLength(SIZE_MAX), m_nContentReceived(0), m_nChuncked(-1), m_nNextChunk(0), m_nChunkFooter(0), m_fnNotify(fnNotify) { } @@ -197,7 +197,7 @@ nSend += nDataLen; this_thread::sleep_for(chrono::milliseconds(10)); m_mxVecData.lock(); } - if (m_vecData.size() > 0) + //if (m_vecData.size() > 0) { data = move(m_vecData.front()); m_vecData.pop_front(); @@ -265,7 +265,7 @@ nSend += nDataLen; this_thread::sleep_for(chrono::milliseconds(10)); m_mxVecData.lock(); } - if (m_vecData.size() > 0) + //if (m_vecData.size() > 0) { data = move(m_vecData.front()); m_vecData.pop_front(); @@ -368,7 +368,7 @@ void HttpFetch::DatenEmpfangen(TcpSocket* const pTcpSocket) //if ((m_nContentLength == SIZE_MAX || m_nContentLength == 0) && m_nChuncked != 0) // Server send a content-length from 0 to signal end of header we are done, and we do not have a chunked transfer encoding! //{ - m_umStreamCache.insert(make_pair(0, STREAMITEM({ 0, deque(), move(m_umRespHeader), 0, 0, INITWINDOWSIZE(m_tuStreamSettings) }))); + m_umStreamCache.insert(make_pair(0, STREAMITEM({ 0, deque(), move(m_umRespHeader), 0, 0, INITWINDOWSIZE(m_tuStreamSettings), {}, {} }))); EndOfStreamAction(m_soMetaDa, 0, m_umStreamCache, m_tuStreamSettings, m_mtxStreams, m_mResWndSizes, atTmp, m_mxVecData, m_vecData, dqAuth); // return; //} @@ -483,7 +483,7 @@ void HttpFetch::DatenEmpfangen(TcpSocket* const pTcpSocket) m_nNextChunk -= nAnzahlDatenBytes; if (nRead == 0 && m_nNextChunk == 0) // we expect the \r\n after the chunk, the next Data we receive should be a \r\n - ; + {} if (nRead >= 2 && string(spBuffer.get() + nWriteOffset).substr(0, 2) == "\r\n") nRead -= 2, nWriteOffset += 2, m_nChunkFooter = 0; @@ -518,7 +518,7 @@ void HttpFetch::SocketError(BaseSocket* const pBaseSocket) pBaseSocket->Close(); } -void HttpFetch::SocketClosing(BaseSocket* const pBaseSocket) +void HttpFetch::SocketClosing(BaseSocket* const /*pBaseSocket*/) { OutputDebugString(L"Http2Fetch::SocketClosing\r\n"); @@ -528,13 +528,13 @@ void HttpFetch::SocketClosing(BaseSocket* const pBaseSocket) m_Timer.get()->Stop(); } -void HttpFetch::OnTimeout(const Timer* const pTimer, TcpSocket* /*pUser*/) +void HttpFetch::OnTimeout(const Timer* const /*pTimer*/, TcpSocket* /*pUser*/) { OutputDebugString(L"Http2Fetch::OnTimeout\r\n"); m_pcClientCon->Close(); } -void HttpFetch::EndOfStreamAction(const MetaSocketData soMetaDa, const uint32_t streamId, STREAMLIST& StreamList, STREAMSETTINGS& tuStreamSettings, mutex& pmtxStream, RESERVEDWINDOWSIZE& maResWndSizes, atomic& patStop, mutex& pmtxReqdata, deque>& vecData, deque& lstAuthInfo) +void HttpFetch::EndOfStreamAction(const MetaSocketData& soMetaDa, const uint32_t streamId, STREAMLIST& StreamList, STREAMSETTINGS& /*tuStreamSettings*/, mutex& /*pmtxStream*/, RESERVEDWINDOWSIZE& /*maResWndSizes*/, atomic& /*patStop*/, mutex& pmtxReqdata, deque>& vecData, deque& /*lstAuthInfo*/) { m_umRespHeader = move(GETHEADERLIST(StreamList.find(streamId))); diff --git a/HttpFetch.h b/HttpFetch.h index e8e310a..6013a49 100644 --- a/HttpFetch.h +++ b/HttpFetch.h @@ -53,7 +53,7 @@ class HttpFetch : public Http2Protocol // shared_ptr m_pTmpFileRec; // shared_ptr m_pTmpFileSend; unique_ptr> m_Timer; - MetaSocketData m_soMetaDa; + MetaSocketData m_soMetaDa{}; string m_strBuffer; HeadList m_umRespHeader; HeadList m_umAddHeader; diff --git a/HttpServ.cpp b/HttpServ.cpp index b08fa9f..14d3705 100644 --- a/HttpServ.cpp +++ b/HttpServ.cpp @@ -1718,7 +1718,7 @@ void CHttpServ::DoAction(const MetaSocketData soMetaDa, const uint8_t httpVers, for (auto& itHeader : lstHeaderFields) { if ((bAuthHandlerInScript == false && itHeader.first == "authorization") - || (nSollLen <= 0 && itHeader.first == "content-length")) + || (nSollLen == 0 && itHeader.first == "content-length")) continue; auto itArray = find_if(begin(caHeaders), end(caHeaders), [&](auto& prItem) noexcept { return prItem.first == itHeader.first ? true : false; }); diff --git a/SpawnProcess.cpp b/SpawnProcess.cpp index 8c7dcd0..fc2119a 100644 --- a/SpawnProcess.cpp +++ b/SpawnProcess.cpp @@ -39,19 +39,13 @@ static const std::vector vEnvFilter{"USER=", "HOME="}; mutex SpawnProcess::s_mtxIOstreams; -SpawnProcess::SpawnProcess() +SpawnProcess::SpawnProcess() : m_fdStdOutPipe{-1,-1}, m_fdStdInPipe{-1,-1}, m_fdStdErrPipe{-1,-1} { - m_fdStdOutPipe[0] = -1; - m_fdStdOutPipe[1] = -1; - m_fdStdInPipe[0] = -1; - m_fdStdInPipe[1] = -1; - m_fdStdErrPipe[0] = -1; - m_fdStdErrPipe[1] = -1; #if defined(_WIN32) || defined(_WIN64) - m_hProcess = INVALID_HANDLE_VALUE; + m_hProcess{INVALID_HANDLE_VALUE}; #endif - char** aszEnv = _environ; + char** aszEnv {_environ}; while (*aszEnv) { if (std::find_if(vEnvFilter.begin(), vEnvFilter.end(), [&](auto& strFilter) { return std::string(*aszEnv).find(strFilter) == 0 ? true : false; }) != vEnvFilter.end())