Merge pull request #725 from oatpp/windows-build-warning

kushnertodd fix to issue #724 Remove warnings from Windows build
This commit is contained in:
Leonid Stryzhevskyi 2023-03-20 02:17:57 +02:00 committed by GitHub
commit 4177fcca7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 8 deletions

View File

@ -53,7 +53,7 @@ std::vector<const char*>& ClassId::getClassNames() {
v_int32 ClassId::registerClassName(const char* name) {
std::lock_guard<std::mutex> lock(getClassMutex());
getClassNames().push_back(name);
return getClassNames().size() - 1;
return (v_int32) getClassNames().size() - 1;
}
ClassId::ClassId(const char* pName)
@ -63,7 +63,7 @@ ClassId::ClassId(const char* pName)
int ClassId::getClassCount() {
std::lock_guard<std::mutex> lock(getClassMutex());
return getClassNames().size();
return (int) getClassNames().size();
}
std::vector<const char*> ClassId::getRegisteredClassNames() {

View File

@ -76,7 +76,7 @@ StringTemplate::StringTemplate(const oatpp::String& text, std::vector<Variable>&
throw std::runtime_error("[oatpp::data::share::StringTemplate::StringTemplate()]: Error. The template variable can't have a negative size.");
}
if(var.posEnd >= m_text->size()) {
if((size_t) var.posEnd >= m_text->size()) {
throw std::runtime_error("[oatpp::data::share::StringTemplate::StringTemplate()]: Error. The template variable can't out-bound the template text.");
}
}
@ -105,7 +105,7 @@ void StringTemplate::format(stream::ConsistentOutputStream* stream, ValueProvide
}
if(prevPos < m_text->size()) {
if((size_t) prevPos < m_text->size()) {
stream->writeSimple(m_text->data() + prevPos, m_text->size() - prevPos);
}

View File

@ -22,6 +22,9 @@
*
***************************************************************************/
#if defined(WIN32) || defined(_WIN32)
_Pragma("warning(disable : 4996)")
#endif
#include "FileStream.hpp"
namespace oatpp { namespace data{ namespace stream {

View File

@ -143,7 +143,7 @@ void ConnectionMonitor::Monitor::monitorTask(std::shared_ptr<Monitor> monitor) {
}
{
std::lock_guard<std::mutex>(monitor->m_runMutex);
std::lock_guard<std::mutex> lock(monitor->m_runMutex);
monitor->m_stopped = true;
}

View File

@ -188,9 +188,11 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
if (hints.ai_family == AF_UNSPEC || hints.ai_family == AF_INET6) {
if (setsockopt(serverHandle, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&no, sizeof( int ) ) != 0 ) {
const size_t buflen = 500;
char buf[buflen];
OATPP_LOGW("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]",
"Warning. Failed to set %s for accepting socket: %s", "IPV6_V6ONLY",
strerror(errno));
strerror_s(buf, buflen, errno));
}
}

View File

@ -304,7 +304,7 @@ oatpp::String Utils::escapeString(const char* data, v_buff_size size, v_uint32 f
}
if(size > safeSize){
for(v_buff_size i = pos; i < result->size(); i ++){
for(v_buff_size i = pos; (size_t) i < result->size(); i ++){
resultData[i] = '?';
}
}

View File

@ -32,6 +32,9 @@ std::shared_ptr<protocol::http::outgoing::Response> ErrorHandler::handleError(co
std::shared_ptr<protocol::http::outgoing::Response> response;
#if defined(WIN32) || defined(_WIN32)
_Pragma("warning(disable : 4068 4996)")
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* Default impl for backwards compatibility until the deprecated methods are removed */

View File

@ -92,7 +92,7 @@ class DtoD : public DtoA {
DTO_INIT(DtoD, DtoA)
DTO_FIELD(Int32, a) = Int64(64);
DTO_FIELD(Int32, a) = Int32(64);
};

View File

@ -22,6 +22,9 @@
*
***************************************************************************/
#if defined(WIN32) || defined(_WIN32)
_Pragma("warning(disable : 4101)")
#endif
#include "ObjectWrapperTest.hpp"
#include "oatpp/core/Types.hpp"

View File

@ -22,6 +22,9 @@
*
***************************************************************************/
#if defined(WIN32) || defined(_WIN32)
_Pragma("warning(disable : 4101)")
#endif
#include "StringTest.hpp"
#include "oatpp/core/Types.hpp"