diff --git a/cmake/compiler-flags.cmake b/cmake/compiler-flags.cmake index 45c55f0a..de8002e4 100644 --- a/cmake/compiler-flags.cmake +++ b/cmake/compiler-flags.cmake @@ -268,7 +268,6 @@ endif (CMAKE_CXX_COMPILER_ID MATCHES GNU) # Disable some warnings # if (CMAKE_CXX_COMPILER_ID MATCHES GNU) - add_compiler_flags(4.6 "-Wno-sign-compare") add_compiler_flags(4.6 "-Wno-unused-parameter") add_compiler_flags(9.1 "-Wno-pessimizing-move") diff --git a/src/oatpp/core/data/buffer/Processor.cpp b/src/oatpp/core/data/buffer/Processor.cpp index 719aae44..4521f6a5 100644 --- a/src/oatpp/core/data/buffer/Processor.cpp +++ b/src/oatpp/core/data/buffer/Processor.cpp @@ -115,7 +115,7 @@ v_int32 ProcessingPipeline::iterate(data::buffer::InlineReadData& dataIn, } data::buffer::InlineReadData* currDataOut = &dataOut; - if(i < m_intermediateData.size()) { + if(i < static_cast(m_intermediateData.size())) { currDataOut = &m_intermediateData[i]; } diff --git a/src/oatpp/core/data/share/MemoryLabel.hpp b/src/oatpp/core/data/share/MemoryLabel.hpp index d8d8d405..9b054bf2 100644 --- a/src/oatpp/core/data/share/MemoryLabel.hpp +++ b/src/oatpp/core/data/share/MemoryLabel.hpp @@ -113,7 +113,7 @@ public: * Capture data referenced by memory label to its own memory. */ void captureToOwnMemory() const { - if(!m_memoryHandle || m_memoryHandle->data() != reinterpret_cast(m_data) || m_memoryHandle->size() != m_size) { + if(!m_memoryHandle || m_memoryHandle->data() != reinterpret_cast(m_data) || static_cast(m_memoryHandle->size()) != m_size) { m_memoryHandle = std::make_shared(reinterpret_cast(m_data), m_size); m_data = m_memoryHandle->data(); } diff --git a/src/oatpp/core/data/share/StringTemplate.cpp b/src/oatpp/core/data/share/StringTemplate.cpp index 5c32b2b3..59872cb2 100644 --- a/src/oatpp/core/data/share/StringTemplate.cpp +++ b/src/oatpp/core/data/share/StringTemplate.cpp @@ -65,7 +65,7 @@ StringTemplate::StringTemplate(const oatpp::String& text, std::vector& , m_variables(variables) { v_buff_size prevPos = 0; - for(v_int32 i = 0; i < m_variables.size(); i++) { + for(size_t i = 0; i < m_variables.size(); i++) { const auto& var = m_variables[i]; if(var.posStart < prevPos) { diff --git a/src/oatpp/core/utils/ConversionUtils.cpp b/src/oatpp/core/utils/ConversionUtils.cpp index 8eb845d3..f0315695 100644 --- a/src/oatpp/core/utils/ConversionUtils.cpp +++ b/src/oatpp/core/utils/ConversionUtils.cpp @@ -36,7 +36,7 @@ namespace oatpp { namespace utils { namespace conversion { v_int32 strToInt32(const oatpp::String& str, bool& success){ char* end; v_int32 result = static_cast(std::strtol(str->data(), &end, 10)); - success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == str->size()); + success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == static_cast(str->size())); return result; } @@ -48,7 +48,7 @@ namespace oatpp { namespace utils { namespace conversion { v_uint32 strToUInt32(const oatpp::String& str, bool& success){ char* end; v_uint32 result = static_cast(std::strtoul(str->data(), &end, 10)); - success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == str->size()); + success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == static_cast(str->size())); return result; } @@ -60,7 +60,7 @@ namespace oatpp { namespace utils { namespace conversion { v_int64 strToInt64(const oatpp::String& str, bool& success){ char* end; v_int64 result = std::strtoll(str->data(), &end, 10); - success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == str->size()); + success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == static_cast(str->size())); return result; } @@ -72,7 +72,7 @@ namespace oatpp { namespace utils { namespace conversion { v_uint64 strToUInt64(const oatpp::String& str, bool& success){ char* end; v_uint64 result = std::strtoull(str->data(), &end, 10); - success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == str->size()); + success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == static_cast(str->size())); return result; } @@ -172,7 +172,7 @@ namespace oatpp { namespace utils { namespace conversion { v_float32 strToFloat32(const oatpp::String& str, bool& success) { char* end; v_float32 result = std::strtof(str->data(), &end); - success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == str->size()); + success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == static_cast(str->size())); return result; } @@ -184,7 +184,7 @@ namespace oatpp { namespace utils { namespace conversion { v_float64 strToFloat64(const oatpp::String& str, bool& success) { char* end; v_float64 result = std::strtod(str->data(), &end); - success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == str->size()); + success = ((reinterpret_cast(end) - reinterpret_cast(str->data())) == static_cast(str->size())); return result; } diff --git a/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.cpp b/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.cpp index 0d55f070..2c3fa2bb 100644 --- a/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.cpp +++ b/src/oatpp/web/protocol/http/incoming/SimpleBodyDecoder.cpp @@ -84,7 +84,7 @@ void SimpleBodyDecoder::handleExpectHeader(const Headers& headers, data::stream: auto expect = headers.getAsMemoryLabel(Header::EXPECT); if(expect == Header::Value::EXPECT_100_CONTINUE) { auto res = connection->writeExactSizeDataSimple(RESPONSE_100_CONTINUE.data(), RESPONSE_100_CONTINUE.size()); - if(res != RESPONSE_100_CONTINUE.size()) { + if(res != static_cast(RESPONSE_100_CONTINUE.size())) { throw std::runtime_error("[oatpp::web::protocol::http::incoming::SimpleBodyDecoder::handleExpectHeader()]: " "Error. Unable to send 100-continue response."); } diff --git a/test/oatpp/core/data/resource/InMemoryDataTest.cpp b/test/oatpp/core/data/resource/InMemoryDataTest.cpp index 648f8b45..07df7325 100644 --- a/test/oatpp/core/data/resource/InMemoryDataTest.cpp +++ b/test/oatpp/core/data/resource/InMemoryDataTest.cpp @@ -47,7 +47,7 @@ void InMemoryDataTest::onRun() { s->writeExactSizeDataSimple(testData->data(), testData->size()); } - OATPP_ASSERT(data.getKnownSize() == testData->size()) + OATPP_ASSERT(data.getKnownSize() == static_cast(testData->size())) OATPP_ASSERT(data.getInMemoryData() == testData) OATPP_ASSERT(data.getLocation() == nullptr) } diff --git a/test/oatpp/core/data/share/LazyStringMapTest.cpp b/test/oatpp/core/data/share/LazyStringMapTest.cpp index 47238a12..6974e4ce 100644 --- a/test/oatpp/core/data/share/LazyStringMapTest.cpp +++ b/test/oatpp/core/data/share/LazyStringMapTest.cpp @@ -70,8 +70,8 @@ void LazyStringMapTest::onRun() { auto s13 = all["key1"]; auto s23 = all["key2"]; - OATPP_ASSERT(s13.getData() == s1->data() && s13.getSize() == s1->size()); - OATPP_ASSERT(s23.getData() == s2->data() && s23.getSize() == s2->size()); + OATPP_ASSERT(s13.getData() == s1->data() && s13.getSize() == static_cast(s1->size())); + OATPP_ASSERT(s23.getData() == s2->data() && s23.getSize() == static_cast(s2->size())); OATPP_ASSERT(s1.get() == s13.getMemoryHandle().get()); OATPP_ASSERT(s2.get() == s23.getMemoryHandle().get()); diff --git a/test/oatpp/core/data/stream/BufferStreamTest.cpp b/test/oatpp/core/data/stream/BufferStreamTest.cpp index b98bc9a4..217da1dc 100644 --- a/test/oatpp/core/data/stream/BufferStreamTest.cpp +++ b/test/oatpp/core/data/stream/BufferStreamTest.cpp @@ -111,10 +111,10 @@ void BufferStreamTest::onRun() { auto wholeText = stream.toString(); - OATPP_ASSERT(wholeText->size() == fragmentsCount * 10); + OATPP_ASSERT(wholeText->size() == static_cast(fragmentsCount * 10)); - v_int32 substringSize = 10; - for(v_int32 i = 0; i < wholeText->size() - substringSize; i ++) { + v_buff_size substringSize = 10; + for(v_buff_size i = 0; i < static_cast(wholeText->size()) - substringSize; i ++) { OATPP_ASSERT(oatpp::String(&wholeText->data()[i], substringSize) == stream.getSubstring(i, substringSize)); } diff --git a/test/oatpp/network/virtual_/InterfaceTest.cpp b/test/oatpp/network/virtual_/InterfaceTest.cpp index 7504c6fb..f8b19d96 100644 --- a/test/oatpp/network/virtual_/InterfaceTest.cpp +++ b/test/oatpp/network/virtual_/InterfaceTest.cpp @@ -56,7 +56,7 @@ namespace { auto socket = submission->getSocket(); auto res = socket->writeExactSizeDataSimple(m_dataSample->data(), m_dataSample->size()); - OATPP_ASSERT(res == m_dataSample->size()); + OATPP_ASSERT(res == static_cast(m_dataSample->size())); v_char8 buffer[100]; oatpp::data::stream::BufferOutputStream stream; @@ -89,7 +89,7 @@ namespace { oatpp::data::stream::BufferOutputStream stream; auto res = oatpp::data::stream::transfer(m_socket.get(), &stream, m_dataSample->size(), buffer, 100); - OATPP_ASSERT(res == m_dataSample->size()); + OATPP_ASSERT(res == static_cast(m_dataSample->size())); OATPP_ASSERT(stream.getCurrentPosition() == res); OATPP_ASSERT(stream.toString() == m_dataSample); diff --git a/test/oatpp/web/mime/multipart/StatefulParserTest.cpp b/test/oatpp/web/mime/multipart/StatefulParserTest.cpp index d0805a2f..c553e33c 100644 --- a/test/oatpp/web/mime/multipart/StatefulParserTest.cpp +++ b/test/oatpp/web/mime/multipart/StatefulParserTest.cpp @@ -112,17 +112,17 @@ void StatefulParserTest::onRun() { oatpp::String text = TEST_DATA_1; - for(v_int32 i = 1; i < text->size(); i++) { + for(size_t i = 1; i < text->size(); i++) { oatpp::web::mime::multipart::PartList multipart("12345"); auto listener = std::make_shared(&multipart); listener->setDefaultPartReader(oatpp::web::mime::multipart::createInMemoryPartReader(128)); - parseStepByStep(text, "12345", listener, i); + parseStepByStep(text, "12345", listener, static_cast(i)); if(multipart.count() != 5) { - OATPP_LOGD(TAG, "TEST_DATA_1 itearation %d", i); + OATPP_LOGD(TAG, "TEST_DATA_1 itearation %lu", i); } OATPP_ASSERT(multipart.count() == 5); diff --git a/test/oatpp/web/protocol/http/encoding/ChunkedTest.cpp b/test/oatpp/web/protocol/http/encoding/ChunkedTest.cpp index d7294625..5c19da9e 100644 --- a/test/oatpp/web/protocol/http/encoding/ChunkedTest.cpp +++ b/test/oatpp/web/protocol/http/encoding/ChunkedTest.cpp @@ -62,7 +62,7 @@ void ChunkedTest::onRun() { auto count = oatpp::data::stream::transfer(&inStream, &outStream, 0, buffer, bufferSize, &decoder); decoded = outStream.toString(); - OATPP_ASSERT(count == encoded->size()); + OATPP_ASSERT(count == static_cast(encoded->size())); OATPP_ASSERT(decoded == ""); } @@ -78,7 +78,7 @@ void ChunkedTest::onRun() { auto count = oatpp::data::stream::transfer(&inStream, &outStream, 0, buffer, bufferSize, &encoder); encoded = outStream.toString(); - OATPP_ASSERT(count == data->size()); + OATPP_ASSERT(count == static_cast(data->size())); OATPP_ASSERT(encoded == "5\r\nHello\r\n5\r\n Worl\r\n4\r\nd!!!\r\n0\r\n\r\n"); } @@ -93,7 +93,7 @@ void ChunkedTest::onRun() { auto count = oatpp::data::stream::transfer(&inStream, &outStream, 0, buffer, bufferSize, &decoder); decoded = outStream.toString(); - OATPP_ASSERT(count == encoded->size()); + OATPP_ASSERT(count == static_cast(encoded->size())); OATPP_LOGD(TAG, "decoded='%s'", decoded->c_str()); OATPP_ASSERT(decoded == data); } @@ -114,7 +114,7 @@ void ChunkedTest::onRun() { auto count = oatpp::data::stream::transfer(&inStream, &outStream, 0, buffer, bufferSize, &pipeline); auto result = outStream.toString(); - OATPP_ASSERT(count == data->size()); + OATPP_ASSERT(count == static_cast(data->size())); OATPP_LOGD(TAG, "result='%s'", result->c_str()); OATPP_ASSERT(result == data); } @@ -122,4 +122,4 @@ void ChunkedTest::onRun() { } -}}}}}} \ No newline at end of file +}}}}}}