mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
Fix compiler warnings (-Wshadow)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
This commit is contained in:
parent
78f2232012
commit
91a7b3ef9c
@ -127,7 +127,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||
add_compiler_flags(4.6 "-Wmissing-include-dirs")
|
||||
add_compiler_flags(4.6 "-Wpointer-arith")
|
||||
add_compiler_flags(4.6 "-Wredundant-decls")
|
||||
#add_compiler_flags(4.6 "-Wshadow")
|
||||
add_compiler_flags(4.6 "-Wshadow")
|
||||
#add_compiler_flags(4.6 "-Wsign-conversion")
|
||||
#add_compiler_flags(4.6 "-Wsuggest-attribute=const")
|
||||
#add_compiler_flags(4.6 "-Wsuggest-attribute=noreturn")
|
||||
|
@ -231,8 +231,8 @@ public:
|
||||
* @param contentType
|
||||
*/
|
||||
template<class Wrapper>
|
||||
ContentHints& addConsumes(const oatpp::String& contentType, const oatpp::String& description = oatpp::String()) {
|
||||
consumes.push_back({contentType, Wrapper::Class::getType(), description});
|
||||
ContentHints& addConsumes(const oatpp::String& contentType, const oatpp::String& desc = oatpp::String()) {
|
||||
consumes.push_back({contentType, Wrapper::Class::getType(), desc});
|
||||
return consumes.back();
|
||||
}
|
||||
|
||||
|
@ -222,35 +222,35 @@ void DTOMapperTest::onRun(){
|
||||
OATPP_LOGV(TAG, "...");
|
||||
|
||||
oatpp::parser::Caret caret(result);
|
||||
auto obj = mapper->readFromCaret<oatpp::Object<Test>>(caret);
|
||||
auto obj1 = mapper->readFromCaret<oatpp::Object<Test>>(caret);
|
||||
|
||||
OATPP_ASSERT(obj->field_string);
|
||||
OATPP_ASSERT(obj->field_string == test1->field_string);
|
||||
OATPP_ASSERT(obj1->field_string);
|
||||
OATPP_ASSERT(obj1->field_string == test1->field_string);
|
||||
|
||||
OATPP_ASSERT(obj->field_int32);
|
||||
OATPP_ASSERT(obj->field_int32 == test1->field_int32);
|
||||
OATPP_ASSERT(obj1->field_int32);
|
||||
OATPP_ASSERT(obj1->field_int32 == test1->field_int32);
|
||||
|
||||
OATPP_ASSERT(obj->field_int64);
|
||||
OATPP_ASSERT(obj->field_int64 == test1->field_int64);
|
||||
OATPP_ASSERT(obj1->field_int64);
|
||||
OATPP_ASSERT(obj1->field_int64 == test1->field_int64);
|
||||
|
||||
OATPP_ASSERT(obj->field_float32);
|
||||
OATPP_ASSERT(obj->field_float32 == test1->field_float32);
|
||||
OATPP_ASSERT(obj1->field_float32);
|
||||
OATPP_ASSERT(obj1->field_float32 == test1->field_float32);
|
||||
|
||||
OATPP_ASSERT(obj->field_float64);
|
||||
OATPP_ASSERT(obj->field_float64 == test1->field_float64);
|
||||
OATPP_ASSERT(obj1->field_float64);
|
||||
OATPP_ASSERT(obj1->field_float64 == test1->field_float64);
|
||||
|
||||
OATPP_ASSERT(obj->field_boolean);
|
||||
OATPP_ASSERT(obj->field_boolean == test1->field_boolean);
|
||||
OATPP_ASSERT(obj1->field_boolean);
|
||||
OATPP_ASSERT(obj1->field_boolean == test1->field_boolean);
|
||||
|
||||
{
|
||||
auto c = obj->field_vector;
|
||||
auto c = obj1->field_vector;
|
||||
OATPP_ASSERT(c[0] == "vector_item1");
|
||||
OATPP_ASSERT(c[1] == "vector_item2");
|
||||
OATPP_ASSERT(c[2] == "vector_item3");
|
||||
}
|
||||
|
||||
{
|
||||
auto c = obj->field_fields;
|
||||
auto c = obj1->field_fields;
|
||||
v_int32 i = 0;
|
||||
for(auto& pair : *c) {
|
||||
OATPP_ASSERT(pair.first == "key" + oatpp::utils::conversion::int32ToStr(i));
|
||||
@ -260,20 +260,20 @@ void DTOMapperTest::onRun(){
|
||||
}
|
||||
|
||||
{
|
||||
auto c = obj->field_unordered_fields;
|
||||
auto c = obj1->field_unordered_fields;
|
||||
OATPP_ASSERT(c["key1"] == "map_item1");
|
||||
OATPP_ASSERT(c["key2"] == "map_item2");
|
||||
OATPP_ASSERT(c["key3"] == "map_item3");
|
||||
}
|
||||
|
||||
result = mapper->writeToString(obj);
|
||||
result = mapper->writeToString(obj1);
|
||||
|
||||
OATPP_LOGV(TAG, "json='%s'", result->c_str());
|
||||
|
||||
{
|
||||
|
||||
auto obj = TestAny::createShared();
|
||||
obj->anyList = {
|
||||
auto obj2 = TestAny::createShared();
|
||||
obj2->anyList = {
|
||||
oatpp::String("Hello Any!!!"),
|
||||
oatpp::Int32(32),
|
||||
oatpp::Int64(64),
|
||||
@ -287,9 +287,9 @@ void DTOMapperTest::onRun(){
|
||||
map["vector"] = oatpp::Vector<oatpp::String>({"vector_v1", "vector_v2", "vector_v3"});
|
||||
map["unordered_map"] = oatpp::UnorderedFields<oatpp::String>({{"key1", "value1"}, {"key2", "value2"}});
|
||||
|
||||
obj->anyList->push_back(map);
|
||||
obj2->anyList->push_back(map);
|
||||
|
||||
auto json = mapper->writeToString(obj);
|
||||
auto json = mapper->writeToString(obj2);
|
||||
OATPP_LOGV(TAG, "any json='%s'", json->c_str());
|
||||
|
||||
auto deserializedAny = mapper->readFromString<oatpp::Fields<oatpp::Any>>(json);
|
||||
|
@ -90,8 +90,8 @@ public:
|
||||
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, serverConnectionHandler)([] {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, router);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::async::Executor>, executor);
|
||||
return oatpp::web::server::AsyncHttpConnectionHandler::createShared(router, executor);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::async::Executor>, executr);
|
||||
return oatpp::web::server::AsyncHttpConnectionHandler::createShared(router, executr);
|
||||
}());
|
||||
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, objectMapper)([] {
|
||||
@ -115,13 +115,13 @@ public:
|
||||
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<app::Client>, appClient)([] {
|
||||
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, clientConnectionProvider);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, objectMapper);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, clientConnectionProvidr);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, objMapper);
|
||||
|
||||
auto retryPolicy = std::make_shared<oatpp::web::client::SimpleRetryPolicy>(5, std::chrono::seconds(1));
|
||||
|
||||
auto requestExecutor = oatpp::web::client::HttpRequestExecutor::createShared(clientConnectionProvider, retryPolicy);
|
||||
return app::Client::createShared(requestExecutor, objectMapper);
|
||||
auto requestExecutor = oatpp::web::client::HttpRequestExecutor::createShared(clientConnectionProvidr, retryPolicy);
|
||||
return app::Client::createShared(requestExecutor, objMapper);
|
||||
|
||||
}());
|
||||
|
||||
|
@ -93,8 +93,8 @@ public:
|
||||
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, serverConnectionHandler)([] {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, router);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::async::Executor>, executor);
|
||||
return oatpp::web::server::AsyncHttpConnectionHandler::createShared(router, executor);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::async::Executor>, executr);
|
||||
return oatpp::web::server::AsyncHttpConnectionHandler::createShared(router, executr);
|
||||
}());
|
||||
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, objectMapper)([] {
|
||||
@ -199,7 +199,7 @@ void FullAsyncTest::onRun() {
|
||||
|
||||
{ // test Big Echo with body
|
||||
oatpp::data::stream::BufferOutputStream stream;
|
||||
for(v_int32 i = 0; i < oatpp::data::buffer::IOBuffer::BUFFER_SIZE; i++) {
|
||||
for(v_int32 j = 0; j < oatpp::data::buffer::IOBuffer::BUFFER_SIZE; j++) {
|
||||
stream.writeSimple("0123456789", 10);
|
||||
}
|
||||
auto data = stream.toString();
|
||||
@ -216,7 +216,7 @@ void FullAsyncTest::onRun() {
|
||||
oatpp::String sample = "__abcdefghijklmnopqrstuvwxyz-0123456789";
|
||||
v_int32 numIterations = 10;
|
||||
oatpp::data::stream::BufferOutputStream stream;
|
||||
for(v_int32 i = 0; i < numIterations; i++) {
|
||||
for(v_int32 j = 0; j < numIterations; j++) {
|
||||
stream.writeSimple(sample->data(), sample->size());
|
||||
}
|
||||
auto data = stream.toString();
|
||||
|
@ -330,7 +330,7 @@ void FullTest::onRun() {
|
||||
|
||||
{ // test Big Echo with body
|
||||
oatpp::data::stream::BufferOutputStream stream;
|
||||
for(v_int32 i = 0; i < oatpp::data::buffer::IOBuffer::BUFFER_SIZE; i++) {
|
||||
for(v_int32 j = 0; j < oatpp::data::buffer::IOBuffer::BUFFER_SIZE; j++) {
|
||||
stream.writeSimple("0123456789", 10);
|
||||
}
|
||||
auto data = stream.toString();
|
||||
@ -436,7 +436,7 @@ void FullTest::onRun() {
|
||||
oatpp::String sample = "__abcdefghijklmnopqrstuvwxyz-0123456789";
|
||||
v_int32 numIterations = 10;
|
||||
oatpp::data::stream::BufferOutputStream stream;
|
||||
for(v_int32 i = 0; i < numIterations; i++) {
|
||||
for(v_int32 j = 0; j < numIterations; j++) {
|
||||
stream.writeSimple(sample->data(), sample->size());
|
||||
}
|
||||
auto data = stream.toString();
|
||||
|
@ -85,8 +85,8 @@ public:
|
||||
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, serverConnectionHandler)([] {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, router);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::async::Executor>, executor);
|
||||
return oatpp::web::server::AsyncHttpConnectionHandler::createShared(router, executor);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::async::Executor>, executr);
|
||||
return oatpp::web::server::AsyncHttpConnectionHandler::createShared(router, executr);
|
||||
}());
|
||||
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, objectMapper)([] {
|
||||
|
Loading…
Reference in New Issue
Block a user