Fix compiler warnings (-Wswitch-enum)

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
This commit is contained in:
Ferry Huberts 2023-08-02 20:47:42 +02:00
parent 24f7c32da7
commit dd69b37872
7 changed files with 21 additions and 0 deletions

View File

@ -43,6 +43,8 @@ void Processor::addWorker(const std::shared_ptr<worker::Worker>& worker) {
m_timerPopQueues.push_back(utils::FastQueue<CoroutineHandle>());
break;
case worker::Worker::Type::PROCESSOR:
case worker::Worker::Type::TYPES_COUNT:
default:
break;

View File

@ -91,6 +91,7 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::get() {
switch(m_address.family) {
case Address::IP_4: hints.ai_family = AF_INET; break;
case Address::IP_6: hints.ai_family = AF_INET6; break;
case Address::UNSPEC:
default:
hints.ai_family = AF_UNSPEC;
}
@ -203,6 +204,7 @@ oatpp::async::CoroutineStarterForResult<const provider::ResourceHandle<data::str
switch(m_address.family) {
case Address::IP_4: hints.ai_family = AF_INET; break;
case Address::IP_6: hints.ai_family = AF_INET6; break;
case Address::UNSPEC:
default:
hints.ai_family = AF_UNSPEC;
}

View File

@ -165,6 +165,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
switch(m_address.family) {
case Address::IP_4: hints.ai_family = AF_INET; break;
case Address::IP_6: hints.ai_family = AF_INET6; break;
case Address::UNSPEC:
default:
hints.ai_family = AF_UNSPEC;
}
@ -254,6 +255,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
switch(m_address.family) {
case Address::IP_4: hints.ai_family = AF_INET; break;
case Address::IP_6: hints.ai_family = AF_INET6; break;
case Address::UNSPEC:
default:
hints.ai_family = AF_UNSPEC;
}

View File

@ -285,6 +285,10 @@ oatpp::Void Deserializer::deserializeEnum(Deserializer* deserializer, parser::Ca
case data::mapping::type::EnumInterpreterError::CONSTRAINT_NOT_NULL:
caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeEnum()]: Error. Enum constraint violated - 'NotNull'.");
break;
case data::mapping::type::EnumInterpreterError::OK:
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
case data::mapping::type::EnumInterpreterError::ENTRY_NOT_FOUND:
default:
caret.setError("[oatpp::parser::json::mapping::Deserializer::deserializeEnum()]: Error. Can't deserialize Enum.");
}

View File

@ -130,6 +130,10 @@ void Serializer::serializeEnum(Serializer* serializer,
switch(e) {
case data::mapping::type::EnumInterpreterError::CONSTRAINT_NOT_NULL:
throw std::runtime_error("[oatpp::parser::json::mapping::Serializer::serializeEnum()]: Error. Enum constraint violated - 'NotNull'.");
case data::mapping::type::EnumInterpreterError::OK:
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
case data::mapping::type::EnumInterpreterError::ENTRY_NOT_FOUND:
default:
throw std::runtime_error("[oatpp::parser::json::mapping::Serializer::serializeEnum()]: Error. Can't serialize Enum.");
}

View File

@ -391,6 +391,9 @@ struct ApiClient::TypeInterpretation<data::mapping::type::EnumObjectWrapper<T, I
throw std::runtime_error(
"[oatpp::web::client::ApiClient::TypeInterpretation::toString()]: Error. Enum constraint violation - NotNull."
);
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM:
case data::mapping::type::EnumInterpreterError::TYPE_MISMATCH_ENUM_VALUE:
case data::mapping::type::EnumInterpreterError::ENTRY_NOT_FOUND:
default:
throw std::runtime_error(
"[oatpp::web::client::ApiClient::TypeInterpretation::toString()]: Error. Can't interpret Enum."

View File

@ -184,6 +184,7 @@ HttpProcessor::ConnectionState HttpProcessor::processNextRequest(ProcessingResou
response->putHeaderIfNotExists(protocol::http::Header::CONNECTION, protocol::http::Header::Value::CONNECTION_CLOSE);
break;
case ConnectionState::DELEGATED:
default:
break;
@ -368,6 +369,7 @@ HttpProcessor::Coroutine::Action HttpProcessor::Coroutine::onResponseFormed() {
m_currentResponse->putHeaderIfNotExists(protocol::http::Header::CONNECTION, protocol::http::Header::Value::CONNECTION_CLOSE);
break;
case ConnectionState::DELEGATED:
default:
break;
@ -400,6 +402,8 @@ HttpProcessor::Coroutine::Action HttpProcessor::Coroutine::onRequestDone() {
break;
}
case ConnectionState::CLOSING:
case ConnectionState::DEAD:
default:
break;