mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2025-01-03 05:22:24 +08:00
Merge pull request #430 from oatpp/enforce_standard_compliance_on_msvc
Added /permissive- flag on MSVC to enforce standard compliancy
This commit is contained in:
commit
1c38fa2c7f
27
fuzzers/oatpp/parser/json/mapping/ObjectMapper.cpp
Normal file
27
fuzzers/oatpp/parser/json/mapping/ObjectMapper.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "oatpp/parser/json/mapping/ObjectMapper.hpp"
|
||||
#include "oatpp/core/macro/codegen.hpp"
|
||||
|
||||
typedef oatpp::parser::Caret ParsingCaret;
|
||||
typedef oatpp::parser::json::mapping::Serializer Serializer;
|
||||
typedef oatpp::parser::json::mapping::Deserializer Deserializer;
|
||||
|
||||
#include OATPP_CODEGEN_BEGIN(DTO)
|
||||
|
||||
class EmptyDto : public oatpp::DTO {
|
||||
DTO_INIT(EmptyDto, DTO)
|
||||
};
|
||||
|
||||
class Test1 : public oatpp::DTO {
|
||||
DTO_INIT(Test1, DTO)
|
||||
DTO_FIELD(String, strF);
|
||||
};
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
oatpp::String input(reinterpret_cast<const char*>(data), size, true);
|
||||
oatpp::parser::json::mapping::ObjectMapper mapper;
|
||||
try {
|
||||
mapper.readFromString<oatpp::Object<Test1>>(input);
|
||||
} catch(...) {}
|
||||
|
||||
return 0;
|
||||
}
|
@ -277,6 +277,9 @@ set_target_properties(oatpp PROPERTIES
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
if (MSVC)
|
||||
target_compile_options(oatpp PRIVATE /permissive-)
|
||||
endif()
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
||||
|
||||
@ -321,6 +324,9 @@ set_target_properties(oatpp-test PROPERTIES
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
if (MSVC)
|
||||
target_compile_options(oatpp-test PRIVATE /permissive-)
|
||||
endif()
|
||||
|
||||
target_link_libraries(oatpp-test PUBLIC oatpp)
|
||||
|
||||
|
@ -168,23 +168,16 @@ CoroutineStarter::CoroutineStarter(CoroutineStarter&& other)
|
||||
}
|
||||
|
||||
CoroutineStarter::~CoroutineStarter() {
|
||||
if(m_first != nullptr) {
|
||||
auto curr = m_first;
|
||||
while(curr != nullptr) {
|
||||
AbstractCoroutine* next = nullptr;
|
||||
if(curr->m_parentReturnAction.m_type == Action::TYPE_COROUTINE) {
|
||||
next = curr->m_parentReturnAction.m_data.coroutine;
|
||||
}
|
||||
delete curr;
|
||||
curr = next;
|
||||
}
|
||||
}
|
||||
freeCoroutines();
|
||||
}
|
||||
|
||||
/*
|
||||
* Move assignment operator.
|
||||
*/
|
||||
CoroutineStarter& CoroutineStarter::operator=(CoroutineStarter&& other) {
|
||||
if (this == std::addressof(other)) return *this;
|
||||
|
||||
freeCoroutines();
|
||||
m_first = other.m_first;
|
||||
m_last = other.m_last;
|
||||
other.m_first = nullptr;
|
||||
@ -216,6 +209,21 @@ CoroutineStarter& CoroutineStarter::next(CoroutineStarter&& starter) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CoroutineStarter::freeCoroutines()
|
||||
{
|
||||
if (m_first != nullptr) {
|
||||
auto curr = m_first;
|
||||
while (curr != nullptr) {
|
||||
AbstractCoroutine* next = nullptr;
|
||||
if (curr->m_parentReturnAction.m_type == Action::TYPE_COROUTINE) {
|
||||
next = curr->m_parentReturnAction.m_data.coroutine;
|
||||
}
|
||||
delete curr;
|
||||
curr = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CoroutineHandle
|
||||
|
||||
|
@ -341,6 +341,11 @@ class CoroutineStarter {
|
||||
private:
|
||||
AbstractCoroutine* m_first;
|
||||
AbstractCoroutine* m_last;
|
||||
|
||||
private:
|
||||
|
||||
void freeCoroutines();
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -597,8 +602,8 @@ public:
|
||||
* @return - &id:oatpp::async::CoroutineStarter;.
|
||||
*/
|
||||
template<typename ...ConstructorArgs>
|
||||
static CoroutineStarter start(ConstructorArgs... args) {
|
||||
return new T(args...);
|
||||
static CoroutineStarter start(ConstructorArgs&&... args) {
|
||||
return new T(std::forward<ConstructorArgs>(args)...);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -686,6 +691,9 @@ public:
|
||||
* Move assignment operator.
|
||||
*/
|
||||
StarterForResult& operator=(StarterForResult&& other) {
|
||||
if (this == std::addressof(other)) return *this;
|
||||
|
||||
delete m_coroutine;
|
||||
m_coroutine = other.m_coroutine;
|
||||
other.m_coroutine = nullptr;
|
||||
return *this;
|
||||
@ -759,7 +767,7 @@ public:
|
||||
* @param ptr - pointer of the function to call.
|
||||
* @return - Action.
|
||||
*/
|
||||
virtual Action call(const AbstractCoroutine::FunctionPtr& ptr) override {
|
||||
Action call(const AbstractCoroutine::FunctionPtr& ptr) override {
|
||||
Function f = static_cast<Function>(ptr);
|
||||
return (static_cast<T*>(this)->*f)();
|
||||
}
|
||||
|
@ -54,12 +54,12 @@ void Executor::SubmissionProcessor::run() {
|
||||
|
||||
void Executor::SubmissionProcessor::pushTasks(oatpp::collection::FastQueue<CoroutineHandle>& tasks) {
|
||||
(void)tasks;
|
||||
std::runtime_error("[oatpp::async::Executor::SubmissionProcessor::pushTasks]: Error. This method does nothing.");
|
||||
throw std::runtime_error("[oatpp::async::Executor::SubmissionProcessor::pushTasks]: Error. This method does nothing.");
|
||||
}
|
||||
|
||||
void Executor::SubmissionProcessor::pushOneTask(CoroutineHandle* task) {
|
||||
(void)task;
|
||||
std::runtime_error("[oatpp::async::Executor::SubmissionProcessor::pushOneTask]: Error. This method does nothing.");
|
||||
throw std::runtime_error("[oatpp::async::Executor::SubmissionProcessor::pushOneTask]: Error. This method does nothing.");
|
||||
}
|
||||
|
||||
void Executor::SubmissionProcessor::stop() {
|
||||
@ -94,7 +94,7 @@ Executor::Executor(v_int32 processorWorkersCount, v_int32 ioWorkersCount, v_int3
|
||||
m_allWorkers.insert(m_allWorkers.end(), m_processorWorkers.begin(), m_processorWorkers.end());
|
||||
|
||||
std::vector<std::shared_ptr<worker::Worker>> ioWorkers;
|
||||
|
||||
ioWorkers.reserve(ioWorkersCount);
|
||||
switch(ioWorkerType) {
|
||||
|
||||
case IO_WORKER_TYPE_NAIVE: {
|
||||
@ -119,6 +119,7 @@ Executor::Executor(v_int32 processorWorkersCount, v_int32 ioWorkersCount, v_int3
|
||||
linkWorkers(ioWorkers);
|
||||
|
||||
std::vector<std::shared_ptr<worker::Worker>> timerWorkers;
|
||||
timerWorkers.reserve(timerWorkersCount);
|
||||
for(v_int32 i = 0; i < timerWorkersCount; i++) {
|
||||
timerWorkers.push_back(std::make_shared<worker::TimerWorker>());
|
||||
}
|
||||
@ -233,10 +234,10 @@ void Executor::stop() {
|
||||
}
|
||||
|
||||
v_int32 Executor::getTasksCount() {
|
||||
|
||||
|
||||
v_int32 result = 0;
|
||||
|
||||
for(auto procWorker : m_processorWorkers) {
|
||||
for(const auto& procWorker : m_processorWorkers) {
|
||||
result += procWorker->getProcessor().getTasksCount();
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ bool Processor::iterate(v_int32 numIterations) {
|
||||
|
||||
auto CP = m_queue.first;
|
||||
if (CP == nullptr) {
|
||||
goto end_loop;
|
||||
break;
|
||||
}
|
||||
if (CP->finished()) {
|
||||
m_queue.popFrontNoData();
|
||||
@ -217,8 +217,6 @@ bool Processor::iterate(v_int32 numIterations) {
|
||||
|
||||
}
|
||||
|
||||
end_loop:
|
||||
|
||||
popTasks();
|
||||
|
||||
std::lock_guard<oatpp::concurrency::SpinLock> lock(m_taskLock);
|
||||
|
@ -34,18 +34,11 @@
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#include <WinSock2.h>
|
||||
#endif
|
||||
|
||||
#if (defined(WIN32) || defined(_WIN32)) && defined(_WIN64)
|
||||
struct tm* localtime_r(time_t *_clock, struct tm *_result) {
|
||||
_localtime64_s(_result, _clock);
|
||||
return _result;
|
||||
}
|
||||
#elif (defined(WIN32) || defined(_WIN32)) && not defined(_WIN64)
|
||||
struct tm* localtime_r(time_t *_clock, struct tm *_result) {
|
||||
_localtime32_s(_result, _clock);
|
||||
return _result;
|
||||
}
|
||||
struct tm* localtime_r(time_t *_clock, struct tm *_result) {
|
||||
localtime_s(_result, _clock);
|
||||
return _result;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace oatpp { namespace base {
|
||||
|
@ -86,11 +86,8 @@ void InlineWriteData::setEof() {
|
||||
// ProcessingPipeline
|
||||
|
||||
ProcessingPipeline::ProcessingPipeline(const std::vector<base::ObjectHandle<Processor>>& processors)
|
||||
: m_processors(processors)
|
||||
: m_processors(processors), m_intermediateData(processors.size() - 1)
|
||||
{
|
||||
for(v_int32 i = 0; i < (v_int32) m_processors.size() - 1; i ++) {
|
||||
m_intermediateData.push_back(data::buffer::InlineReadData());
|
||||
}
|
||||
}
|
||||
|
||||
v_io_size ProcessingPipeline::suggestInputStreamReadSize() {
|
||||
|
@ -87,6 +87,8 @@ namespace __class {
|
||||
: notNull(pNotNull)
|
||||
{}
|
||||
|
||||
virtual ~PolymorphicDispatcher() = default;
|
||||
|
||||
const bool notNull;
|
||||
|
||||
virtual type::Void createObject() const = 0;
|
||||
@ -495,7 +497,7 @@ Void EnumInterpreterAsString<T, notnull>::fromInterpretation(const Void& interVa
|
||||
try {
|
||||
const auto &entry = EnumOW::getEntryByName(interValue.staticCast<String>());
|
||||
return EnumOW(entry.value);
|
||||
} catch (const std::runtime_error& e) { // TODO - add a specific error for this.
|
||||
} catch (const std::runtime_error&) { // TODO - add a specific error for this.
|
||||
error = EnumInterpreterError::ENTRY_NOT_FOUND;
|
||||
}
|
||||
return Void(nullptr, EnumOW::Class::getType());
|
||||
@ -556,7 +558,7 @@ Void EnumInterpreterAsNumber<T, notnull>::fromInterpretation(const Void& interVa
|
||||
interValue.staticCast<OW>()
|
||||
);
|
||||
return EnumOW(entry.value);
|
||||
} catch (const std::runtime_error& e) { // TODO - add a specific error for this.
|
||||
} catch (const std::runtime_error&) { // TODO - add a specific error for this.
|
||||
error = EnumInterpreterError::ENTRY_NOT_FOUND;
|
||||
}
|
||||
return Void(nullptr, EnumOW::Class::getType());
|
||||
|
@ -51,6 +51,8 @@ namespace __class {
|
||||
class PolymorphicDispatcher {
|
||||
public:
|
||||
|
||||
virtual ~PolymorphicDispatcher() = default;
|
||||
|
||||
virtual type::Void createObject() const = 0;
|
||||
|
||||
/**
|
||||
|
@ -176,6 +176,8 @@ namespace __class {
|
||||
|
||||
class PolymorphicDispatcher {
|
||||
public:
|
||||
|
||||
virtual ~PolymorphicDispatcher() = default;
|
||||
|
||||
virtual type::Void createObject() const = 0;
|
||||
|
||||
|
@ -52,6 +52,8 @@ namespace __class {
|
||||
class PolymorphicDispatcher {
|
||||
public:
|
||||
|
||||
virtual ~PolymorphicDispatcher() = default;
|
||||
|
||||
virtual type::Void createObject() const = 0;
|
||||
|
||||
/**
|
||||
|
@ -230,6 +230,9 @@ public:
|
||||
*/
|
||||
class AbstractInterpretation {
|
||||
public:
|
||||
|
||||
virtual ~AbstractInterpretation() = default;
|
||||
|
||||
/**
|
||||
* Convert the object to its interpretation.
|
||||
* @param originalValue
|
||||
|
@ -51,6 +51,8 @@ namespace __class {
|
||||
*/
|
||||
class PolymorphicDispatcher {
|
||||
public:
|
||||
|
||||
virtual ~PolymorphicDispatcher() = default;
|
||||
|
||||
virtual type::Void createObject() const = 0;
|
||||
|
||||
|
@ -51,6 +51,8 @@ namespace __class {
|
||||
class PolymorphicDispatcher {
|
||||
public:
|
||||
|
||||
virtual ~PolymorphicDispatcher() = default;
|
||||
|
||||
virtual type::Void createObject() const = 0;
|
||||
|
||||
/**
|
||||
|
@ -51,6 +51,8 @@ namespace __class {
|
||||
class PolymorphicDispatcher {
|
||||
public:
|
||||
|
||||
virtual ~PolymorphicDispatcher() = default;
|
||||
|
||||
virtual type::Void createObject() const = 0;
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ oatpp::async::CoroutineStarter BufferOutputStream::flushToStreamAsync(const std:
|
||||
, m_stream(stream)
|
||||
{}
|
||||
|
||||
Action act() {
|
||||
Action act() override {
|
||||
if(m_inlineData.currBufferPtr == nullptr) {
|
||||
m_inlineData.currBufferPtr = m_this->m_data;
|
||||
m_inlineData.bytesLeft = m_this->m_position;
|
||||
|
@ -119,7 +119,7 @@ async::CoroutineStarter WriteCallback::writeExactSizeDataAsync(const void* data,
|
||||
, m_inlineData(data, size)
|
||||
{}
|
||||
|
||||
Action act() {
|
||||
Action act() override {
|
||||
return m_this->writeExactSizeDataAsyncInline(m_inlineData, finish());
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ void Server::run(std::function<bool()> conditional) {
|
||||
|
||||
void Server::run(bool startAsNewThread) {
|
||||
std::unique_lock<std::mutex> ul(m_mutex);
|
||||
OATPP_LOGW("[oatpp::network::server::run(bool)]", "Using oatpp::network::server::run(bool) is deprecated and will be removed in the next release. Please implement your own threading.")
|
||||
OATPP_LOGW("[oatpp::network::server::run(bool)]", "Using oatpp::network::server::run(bool) is deprecated and will be removed in the next release. Please implement your own threading (See https://github.com/oatpp/oatpp-threaded-starter).")
|
||||
switch (getStatus()) {
|
||||
case STATUS_STARTING:
|
||||
throw std::runtime_error("[oatpp::network::server::run()] Error. Server already starting");
|
||||
|
@ -127,6 +127,13 @@ public:
|
||||
* to &id:oatpp::network::ConnectionHandler;.
|
||||
* @param startAsNewThread - Start the server blocking (thread of callee) or non-blocking (own thread)
|
||||
* @deprecated Deprecated since 1.3.0, will be removed in the next release.
|
||||
* The new repository https://github.com/oatpp/oatpp-threaded-starter shows many configurations how to run Oat++ in its own thread.
|
||||
* From simple No-Stop to Stop-Simple and ending in Oat++ completely isolated in its own thread-scope.
|
||||
* We recommend the Stop-Simple for most applications! You can find it here: https://github.com/oatpp/oatpp-threaded-starter/blob/master/src/App_StopSimple.cpp
|
||||
* The other examples are non trivial and highly specialized on specific environments or requirements.
|
||||
* Please read the comments carefully and think about the consequences twice.
|
||||
* If someone wants to use them please get back to us in an issue in the new repository and we can assist you with them.
|
||||
* Again: These examples introduce special conditions and requirements for your code!
|
||||
*/
|
||||
void run(bool startAsNewThread);
|
||||
|
||||
|
@ -43,6 +43,31 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Workaround for MinGW from: https://www.mail-archive.com/users@ipv6.org/msg02107.html
|
||||
#if defined(__MINGW32__) && _WIN32_WINNT < 0x0600
|
||||
const char * inet_ntop (int af, const void *src, char *dst, socklen_t cnt) {
|
||||
if (af == AF_INET) {
|
||||
struct sockaddr_in in;
|
||||
|
||||
memset (&in, 0, sizeof(in));
|
||||
in.sin_family = AF_INET;
|
||||
memcpy (&in.sin_addr, src, sizeof(struct in_addr));
|
||||
getnameinfo ((struct sockaddr *)&in, sizeof (struct sockaddr_in), dst, cnt, NULL, 0, NI_NUMERICHOST);
|
||||
return dst;
|
||||
} else if (af == AF_INET6) {
|
||||
struct sockaddr_in6 in;
|
||||
memset (&in, 0, sizeof(in));
|
||||
in.sin6_family = AF_INET6;
|
||||
memcpy (&in.sin6_addr, src, sizeof(struct in_addr6));
|
||||
getnameinfo ((struct sockaddr *)&in, sizeof (struct sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST);
|
||||
return dst;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace oatpp { namespace network { namespace tcp { namespace server {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -97,8 +122,6 @@ void ConnectionProvider::stop() {
|
||||
|
||||
oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
int iResult;
|
||||
|
||||
SOCKET serverHandle = INVALID_SOCKET;
|
||||
|
||||
struct addrinfo *result = nullptr;
|
||||
@ -118,7 +141,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
auto portStr = oatpp::utils::conversion::int32ToStr(m_address.port);
|
||||
|
||||
iResult = getaddrinfo(m_address.host->c_str(), portStr->c_str(), &hints, &result);
|
||||
const int iResult = getaddrinfo(m_address.host->c_str(), portStr->c_str(), &hints, &result);
|
||||
if (iResult != 0) {
|
||||
OATPP_LOGE("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]", "Error. Call to getaddrinfo() failed with result=%d", iResult);
|
||||
throw std::runtime_error("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: Error. Call to getaddrinfo() failed.");
|
||||
@ -159,6 +182,13 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
throw std::runtime_error("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: Error. Call to ioctlsocket failed.");
|
||||
}
|
||||
|
||||
// Update port after binding (typicaly in case of port = 0)
|
||||
struct ::sockaddr_in s_in;
|
||||
::memset(&s_in, 0, sizeof(s_in));
|
||||
::socklen_t s_in_len = sizeof(s_in);
|
||||
::getsockname(serverHandle, (struct sockaddr *)&s_in, &s_in_len);
|
||||
setProperty(PROPERTY_PORT, oatpp::utils::conversion::int32ToStr(ntohs(s_in.sin_port)));
|
||||
|
||||
return serverHandle;
|
||||
|
||||
}
|
||||
@ -232,6 +262,13 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
fcntl(serverHandle, F_SETFL, O_NONBLOCK);
|
||||
|
||||
// Update port after binding (typicaly in case of port = 0)
|
||||
struct ::sockaddr_in s_in;
|
||||
::memset(&s_in, 0, sizeof(s_in));
|
||||
::socklen_t s_in_len = sizeof(s_in);
|
||||
::getsockname(serverHandle, (struct sockaddr *)&s_in, &s_in_len);
|
||||
setProperty(PROPERTY_PORT, oatpp::utils::conversion::int32ToStr(ntohs(s_in.sin_port)));
|
||||
|
||||
return serverHandle;
|
||||
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
* Invalidate connection.
|
||||
* @param connectionHandle
|
||||
*/
|
||||
virtual void invalidateConnection(const std::shared_ptr<ConnectionHandle>& connectionHandle) override;
|
||||
void invalidateConnection(const std::shared_ptr<ConnectionHandle>& connectionHandle) override;
|
||||
|
||||
/**
|
||||
* Execute http request.
|
||||
|
@ -33,7 +33,7 @@ namespace oatpp { namespace web { namespace mime { namespace multipart {
|
||||
|
||||
Part::Part(const Headers &headers,
|
||||
const std::shared_ptr<data::stream::InputStream> &inputStream,
|
||||
const oatpp::String inMemoryData,
|
||||
const oatpp::String& inMemoryData,
|
||||
v_int64 knownSize)
|
||||
: m_headers(headers)
|
||||
, m_inputStream(inputStream)
|
||||
@ -60,7 +60,7 @@ Part::Part(const Headers& headers) : Part(headers, nullptr, nullptr, -1) {}
|
||||
Part::Part() : Part(Headers(), nullptr, nullptr, -1) {}
|
||||
|
||||
void Part::setDataInfo(const std::shared_ptr<data::stream::InputStream>& inputStream,
|
||||
const oatpp::String inMemoryData,
|
||||
const oatpp::String& inMemoryData,
|
||||
v_int64 knownSize)
|
||||
{
|
||||
m_inputStream = inputStream;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
*/
|
||||
Part(const Headers& headers,
|
||||
const std::shared_ptr<data::stream::InputStream>& inputStream,
|
||||
const oatpp::String inMemoryData,
|
||||
const oatpp::String& inMemoryData,
|
||||
v_int64 knownSize);
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ public:
|
||||
* @param knownSize - known size of the data in the input stream. Pass `-1` value if size is unknown.
|
||||
*/
|
||||
void setDataInfo(const std::shared_ptr<data::stream::InputStream>& inputStream,
|
||||
const oatpp::String inMemoryData,
|
||||
const oatpp::String& inMemoryData,
|
||||
v_int64 knownSize);
|
||||
|
||||
/**
|
||||
|
@ -158,14 +158,14 @@ oatpp::async::CoroutineStarter Request::sendAsync(std::shared_ptr<Request> _this
|
||||
std::shared_ptr<oatpp::data::stream::BufferOutputStream> m_headersWriteBuffer;
|
||||
public:
|
||||
|
||||
SendAsyncCoroutine(const std::shared_ptr<Request>& request,
|
||||
SendAsyncCoroutine(std::shared_ptr<Request> request,
|
||||
const std::shared_ptr<data::stream::OutputStream>& stream)
|
||||
: m_this(request)
|
||||
: m_this(std::move(request))
|
||||
, m_stream(stream)
|
||||
, m_headersWriteBuffer(std::make_shared<oatpp::data::stream::BufferOutputStream>())
|
||||
{}
|
||||
|
||||
Action act() {
|
||||
Action act() override {
|
||||
|
||||
v_buff_size bodySize = -1;
|
||||
|
||||
@ -231,7 +231,7 @@ oatpp::async::CoroutineStarter Request::sendAsync(std::shared_ptr<Request> _this
|
||||
|
||||
};
|
||||
|
||||
return SendAsyncCoroutine::start(_this, stream);
|
||||
return SendAsyncCoroutine::start(std::move(_this), stream);
|
||||
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,9 @@ set_target_properties(oatppAllTests PROPERTIES
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
if (MSVC)
|
||||
target_compile_options(oatppAllTests PRIVATE /permissive-)
|
||||
endif()
|
||||
|
||||
target_include_directories(oatppAllTests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
@ -95,7 +95,7 @@ void TypeResolverTest::onRun() {
|
||||
dto1->f_int64 = 64;
|
||||
dto1->f_uint64 = 6464;
|
||||
|
||||
dto1->f_float32 = 0.32;
|
||||
dto1->f_float32 = 0.32f;
|
||||
dto1->f_float64 = 0.64;
|
||||
|
||||
dto1->f_bool = true;
|
||||
|
@ -116,7 +116,7 @@ void AnyTest::onRun() {
|
||||
|
||||
try {
|
||||
auto obj = any.retrieve<oatpp::Object<Dto2>>(); // wrong object
|
||||
} catch (std::runtime_error& e) {
|
||||
} catch (std::runtime_error&) {
|
||||
wasError = true;
|
||||
}
|
||||
|
||||
|
@ -42,15 +42,15 @@ void PrimitiveTest::onRun() {
|
||||
|
||||
{
|
||||
checkHash(oatpp::Boolean(true));
|
||||
checkHash(oatpp::Int8(0xFF));
|
||||
checkHash(oatpp::Int8(0x7F));
|
||||
checkHash(oatpp::UInt8(0xFF));
|
||||
checkHash(oatpp::Int16(0xFFFF));
|
||||
checkHash(oatpp::Int16(0x7FFF));
|
||||
checkHash(oatpp::UInt16(0xFFFF));
|
||||
checkHash(oatpp::Int32(0xFFFFFFFF));
|
||||
checkHash(oatpp::Int32(0x7FFFFFFF));
|
||||
checkHash(oatpp::UInt32(0xFFFFFFFF));
|
||||
checkHash(oatpp::Int64(0xFFFFFFFFFFFFFFFF));
|
||||
checkHash(oatpp::Int64(0x7FFFFFFFFFFFFFFF));
|
||||
checkHash(oatpp::UInt64(0xFFFFFFFFFFFFFFFF));
|
||||
checkHash(oatpp::Float32(0.2));
|
||||
checkHash(oatpp::Float32(0.2f));
|
||||
checkHash(oatpp::Float64(0.2));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user