From bb4f4c196b5f7dbc6e2c4bc6009c03d672230181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Sun, 29 Mar 2020 00:33:06 +0100 Subject: [PATCH] Comment unused parameters. --- .../core/async/worker/IOEventWorker_epoll.cpp | 2 + src/oatpp/core/data/stream/BufferStream.cpp | 4 +- src/oatpp/core/data/stream/ChunkedBuffer.cpp | 87 ++++++++++--------- src/oatpp/core/data/stream/FileStream.cpp | 2 + src/oatpp/parser/json/Beautifier.cpp | 1 + src/oatpp/parser/json/mapping/Serializer.cpp | 1 + src/oatpp/parser/json/mapping/Serializer.hpp | 2 + src/oatpp/web/client/RetryPolicy.cpp | 4 +- .../web/protocol/http/outgoing/BufferBody.cpp | 3 +- 9 files changed, 60 insertions(+), 46 deletions(-) diff --git a/src/oatpp/core/async/worker/IOEventWorker_epoll.cpp b/src/oatpp/core/async/worker/IOEventWorker_epoll.cpp index e69f08a2..70780ee5 100644 --- a/src/oatpp/core/async/worker/IOEventWorker_epoll.cpp +++ b/src/oatpp/core/async/worker/IOEventWorker_epoll.cpp @@ -85,10 +85,12 @@ void IOEventWorker::triggerWakeup() { } void IOEventWorker::setTriggerEvent(p_char8 eventPtr) { + (void) eventPtr; // DO NOTHING } void IOEventWorker::setCoroutineEvent(CoroutineHandle* coroutine, int operation, p_char8 eventPtr) { + (void) eventPtr; auto& action = getCoroutineScheduledAction(coroutine); diff --git a/src/oatpp/core/data/stream/BufferStream.cpp b/src/oatpp/core/data/stream/BufferStream.cpp index 5d0ba25d..a3dd7e82 100644 --- a/src/oatpp/core/data/stream/BufferStream.cpp +++ b/src/oatpp/core/data/stream/BufferStream.cpp @@ -44,6 +44,7 @@ BufferOutputStream::~BufferOutputStream() { } v_io_size BufferOutputStream::write(const void *data, v_buff_size count, async::Action& action) { + (void) action; reserveBytesUpfront(count); @@ -190,6 +191,7 @@ void BufferInputStream::reset() { } v_io_size BufferInputStream::read(void *data, v_buff_size count, async::Action& action) { + (void) action; v_buff_size desiredAmount = count; if(desiredAmount > m_size - m_position) { desiredAmount = m_size - m_position; @@ -231,4 +233,4 @@ void BufferInputStream::setCurrentPosition(v_buff_size position) { m_position = position; } -}}} \ No newline at end of file +}}} diff --git a/src/oatpp/core/data/stream/ChunkedBuffer.cpp b/src/oatpp/core/data/stream/ChunkedBuffer.cpp index f0104cb9..d30e502a 100644 --- a/src/oatpp/core/data/stream/ChunkedBuffer.cpp +++ b/src/oatpp/core/data/stream/ChunkedBuffer.cpp @@ -29,7 +29,7 @@ namespace oatpp { namespace data{ namespace stream { data::stream::DefaultInitializedContext ChunkedBuffer::DEFAULT_CONTEXT(data::stream::StreamType::STREAM_INFINITE); const char* ChunkedBuffer::ERROR_ASYNC_FAILED_TO_WRITE_ALL_DATA = "ERROR_ASYNC_FAILED_TO_WRITE_ALL_DATA"; - + const char* const ChunkedBuffer::CHUNK_POOL_NAME = "ChunkedBuffer_Chunk_Pool"; const v_buff_size ChunkedBuffer::CHUNK_ENTRY_SIZE_INDEX_SHIFT = 11; @@ -64,7 +64,7 @@ void ChunkedBuffer::freeEntry(ChunkEntry* entry){ oatpp::base::memory::MemoryPool::free(entry->chunk); delete entry; } - + v_io_size ChunkedBuffer::writeToEntry(ChunkEntry* entry, const void *data, v_buff_size count, @@ -80,7 +80,7 @@ v_io_size ChunkedBuffer::writeToEntry(ChunkEntry* entry, return count; } } - + v_io_size ChunkedBuffer::writeToEntryFrom(ChunkEntry* entry, v_buff_size inChunkPos, const void *data, @@ -98,7 +98,7 @@ v_io_size ChunkedBuffer::writeToEntryFrom(ChunkEntry* entry, return count; } } - + ChunkedBuffer::ChunkEntry* ChunkedBuffer::getChunkForPosition(ChunkEntry* fromChunk, v_buff_size pos, v_buff_size& outChunkPos) @@ -106,48 +106,49 @@ ChunkedBuffer::ChunkEntry* ChunkedBuffer::getChunkForPosition(ChunkEntry* fromCh v_buff_size segIndex = pos >> CHUNK_ENTRY_SIZE_INDEX_SHIFT; outChunkPos = pos - (segIndex << CHUNK_ENTRY_SIZE_INDEX_SHIFT); - + auto curr = fromChunk; - + for(v_buff_size i = 0; i < segIndex; i++){ curr = curr->next; } - + return curr; - + } - + v_io_size ChunkedBuffer::write(const void *data, v_buff_size count, async::Action& action){ - + (void) action; + if(count <= 0){ return 0; } - + if(m_lastEntry == nullptr){ obtainNewEntry(); } - + ChunkEntry* entry = m_lastEntry; v_buff_size pos = 0; - + pos += writeToEntryFrom(entry, m_chunkPos, data, count, m_chunkPos); - + if(m_chunkPos == 0){ entry = obtainNewEntry(); } - + while (pos < count) { - + pos += writeToEntry(entry, &((p_char8) data)[pos], count - pos, m_chunkPos); - + if(m_chunkPos == 0){ entry = obtainNewEntry(); } } - + m_size += pos; // pos == count return count; - + } void ChunkedBuffer::setOutputStreamIOMode(IOMode ioMode) { @@ -161,16 +162,16 @@ IOMode ChunkedBuffer::getOutputStreamIOMode() { Context& ChunkedBuffer::getOutputStreamContext() { return DEFAULT_CONTEXT; } - + v_io_size ChunkedBuffer::readSubstring(void *buffer, v_buff_size pos, v_buff_size count) { - + if(pos < 0 || pos >= m_size){ return 0; } - + v_buff_size countToRead; if(pos + count > m_size){ countToRead = m_size - pos; @@ -183,34 +184,34 @@ v_io_size ChunkedBuffer::readSubstring(void *buffer, v_buff_size lastChunkPos; auto lastChunk = getChunkForPosition(firstChunk, firstChunkPos + countToRead, lastChunkPos); - + v_io_size bufferPos = 0; - + if(firstChunk != lastChunk){ - + v_buff_size countToCopy = CHUNK_ENTRY_SIZE - firstChunkPos; std::memcpy(buffer, &((p_char8)firstChunk->chunk)[firstChunkPos], (size_t)countToCopy); bufferPos += countToCopy; - + auto curr = firstChunk->next; - + while (curr != lastChunk) { std::memcpy(&((p_char8)buffer)[bufferPos], curr->chunk, CHUNK_ENTRY_SIZE); bufferPos += CHUNK_ENTRY_SIZE; curr = curr->next; } - + std::memcpy(&((p_char8)buffer)[bufferPos], lastChunk->chunk, (size_t)lastChunkPos); - + } else { v_buff_size countToCopy = lastChunkPos - firstChunkPos; std::memcpy(buffer, &((p_char8)firstChunk->chunk)[firstChunkPos], (size_t)countToCopy); } - + return countToRead; - + } - + oatpp::String ChunkedBuffer::getSubstring(v_buff_size pos, v_buff_size count){ auto str = oatpp::String((v_int32) count); readSubstring(str->getData(), pos, count); @@ -240,7 +241,7 @@ bool ChunkedBuffer::flushToStream(OutputStream* stream){ } oatpp::async::CoroutineStarter ChunkedBuffer::flushToStreamAsync(const std::shared_ptr& stream) { - + class FlushCoroutine : public oatpp::async::Coroutine { private: std::shared_ptr m_chunkedBuffer; @@ -251,7 +252,7 @@ oatpp::async::CoroutineStarter ChunkedBuffer::flushToStreamAsync(const std::shar data::buffer::InlineWriteData m_currData; bool m_needInit; public: - + FlushCoroutine(const std::shared_ptr& chunkedBuffer, const std::shared_ptr& stream) : m_chunkedBuffer(chunkedBuffer) @@ -289,17 +290,17 @@ oatpp::async::CoroutineStarter ChunkedBuffer::flushToStreamAsync(const std::shar } } - + Action writeCurrData() { return m_stream->writeExactSizeDataAsyncInline(m_currData, Action::clone(m_nextAction)); } - + }; - + return FlushCoroutine::start(shared_from_this(), stream); - + } - + std::shared_ptr ChunkedBuffer::getChunks() { auto chunks = Chunks::createShared(); auto curr = m_firstEntry; @@ -321,19 +322,19 @@ v_buff_size ChunkedBuffer::getSize(){ } void ChunkedBuffer::clear(){ - + ChunkEntry* curr = m_firstEntry; while (curr != nullptr) { ChunkEntry* next = curr->next; freeEntry(curr); curr = next; } - + m_size = 0; m_chunkPos = 0; m_firstEntry = nullptr; m_lastEntry = nullptr; - + } - + }}} diff --git a/src/oatpp/core/data/stream/FileStream.cpp b/src/oatpp/core/data/stream/FileStream.cpp index 7e292147..dbc9ca51 100644 --- a/src/oatpp/core/data/stream/FileStream.cpp +++ b/src/oatpp/core/data/stream/FileStream.cpp @@ -58,6 +58,7 @@ std::FILE* FileInputStream::getFile() { } v_io_size FileInputStream::read(void *data, v_buff_size count, async::Action& action) { + (void) action; return std::fread(data, 1, count, m_file); } @@ -104,6 +105,7 @@ std::FILE* FileOutputStream::getFile() { } v_io_size FileOutputStream::write(const void *data, v_buff_size count, async::Action& action) { + (void) action; return std::fwrite(data, 1, count, m_file); } diff --git a/src/oatpp/parser/json/Beautifier.cpp b/src/oatpp/parser/json/Beautifier.cpp index 631bb43a..c1ebfb53 100644 --- a/src/oatpp/parser/json/Beautifier.cpp +++ b/src/oatpp/parser/json/Beautifier.cpp @@ -46,6 +46,7 @@ void Beautifier::writeIndent(ConsistentOutputStream* outputStream) { } v_io_size Beautifier::write(const void *data, v_buff_size count, async::Action& action) { + (void) action; oatpp::data::stream::BufferOutputStream buffer(count); diff --git a/src/oatpp/parser/json/mapping/Serializer.cpp b/src/oatpp/parser/json/mapping/Serializer.cpp index 6374dc6a..961eb590 100644 --- a/src/oatpp/parser/json/mapping/Serializer.cpp +++ b/src/oatpp/parser/json/mapping/Serializer.cpp @@ -78,6 +78,7 @@ void Serializer::serializeString(Serializer* serializer, data::stream::ConsistentOutputStream* stream, const data::mapping::type::AbstractObjectWrapper& polymorph) { + (void) serializer; if(!polymorph) { stream->writeSimple("null", 4); diff --git a/src/oatpp/parser/json/mapping/Serializer.hpp b/src/oatpp/parser/json/mapping/Serializer.hpp index ae6d0c00..52e267a3 100644 --- a/src/oatpp/parser/json/mapping/Serializer.hpp +++ b/src/oatpp/parser/json/mapping/Serializer.hpp @@ -120,6 +120,8 @@ private: static void serializePrimitive(Serializer* serializer, data::stream::ConsistentOutputStream* stream, const data::mapping::type::AbstractObjectWrapper& polymorph){ + (void) serializer; + if(polymorph){ stream->writeAsString(static_cast(polymorph.get())->getValue()); } else { diff --git a/src/oatpp/web/client/RetryPolicy.cpp b/src/oatpp/web/client/RetryPolicy.cpp index ef7fdaf0..cf632518 100644 --- a/src/oatpp/web/client/RetryPolicy.cpp +++ b/src/oatpp/web/client/RetryPolicy.cpp @@ -39,11 +39,13 @@ bool SimpleRetryPolicy::canRetry(const Context& context) { } bool SimpleRetryPolicy::retryOnResponse(v_int32 responseStatusCode, const Context& context) { + (void) context; return m_httpCodes.find(responseStatusCode) != m_httpCodes.end(); } v_int64 SimpleRetryPolicy::waitForMicroseconds(const Context& context) { + (void) context; return m_delay; } -}}} \ No newline at end of file +}}} diff --git a/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp b/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp index 9e219516..42f7bb0e 100644 --- a/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp +++ b/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp @@ -37,6 +37,7 @@ std::shared_ptr BufferBody::createShared(const oatpp::String& buffer } v_io_size BufferBody::read(void *buffer, v_buff_size count, async::Action& action) { + (void) action; v_buff_size desiredToRead = m_inlineData.bytesLeft; @@ -71,4 +72,4 @@ v_buff_size BufferBody::getKnownSize() { return m_buffer->getSize(); } -}}}}} \ No newline at end of file +}}}}}