mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
Fix compiler warnings (-Wredundant-tags)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
This commit is contained in:
parent
e33e6d567e
commit
53b8ab37b9
@ -50,11 +50,11 @@ void IOEventWorker::initEventQueue() {
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::initEventQueue()]: Error. Call to ::epoll_create1() failed.");
|
||||
}
|
||||
|
||||
m_outEvents = std::unique_ptr<v_char8[]>(new (std::nothrow) v_char8[MAX_EVENTS * sizeof(struct epoll_event)]);
|
||||
m_outEvents = std::unique_ptr<v_char8[]>(new (std::nothrow) v_char8[MAX_EVENTS * sizeof(epoll_event)]);
|
||||
|
||||
if(!m_outEvents) {
|
||||
OATPP_LOGE("[oatpp::async::worker::IOEventWorker::initEventQueue()]",
|
||||
"Error. Unable to allocate %d bytes for events.", MAX_EVENTS * sizeof(struct epoll_event));
|
||||
"Error. Unable to allocate %d bytes for events.", MAX_EVENTS * sizeof(epoll_event));
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::initEventQueue()]: Error. Unable to allocate memory for events.");
|
||||
}
|
||||
|
||||
@ -65,8 +65,8 @@ void IOEventWorker::initEventQueue() {
|
||||
throw std::runtime_error("[oatpp::async::worker::IOEventWorker::initEventQueue()]: Error. Call to ::eventfd() failed.");
|
||||
}
|
||||
|
||||
struct epoll_event event;
|
||||
std::memset(&event, 0, sizeof(struct epoll_event));
|
||||
epoll_event event;
|
||||
std::memset(&event, 0, sizeof(epoll_event));
|
||||
|
||||
event.data.ptr = this;
|
||||
|
||||
@ -109,8 +109,8 @@ void IOEventWorker::setCoroutineEvent(CoroutineHandle* coroutine, int operation,
|
||||
|
||||
}
|
||||
|
||||
struct epoll_event event;
|
||||
std::memset(&event, 0, sizeof(struct epoll_event));
|
||||
epoll_event event;
|
||||
std::memset(&event, 0, sizeof(epoll_event));
|
||||
|
||||
event.data.ptr = coroutine;
|
||||
|
||||
@ -155,7 +155,7 @@ void IOEventWorker::consumeBacklog() {
|
||||
|
||||
void IOEventWorker::waitEvents() {
|
||||
|
||||
struct epoll_event* outEvents = (struct epoll_event*)m_outEvents.get();
|
||||
epoll_event* outEvents = (epoll_event*)m_outEvents.get();
|
||||
auto eventsCount = epoll_wait(m_eventQueueHandle, outEvents, MAX_EVENTS, -1);
|
||||
|
||||
if((eventsCount < 0) && (errno != EINTR)) {
|
||||
|
@ -101,7 +101,7 @@ void DefaultLogger::log(v_uint32 priority, const std::string& tag, const std::st
|
||||
|
||||
if (m_config.timeFormat) {
|
||||
time_t seconds = std::chrono::duration_cast<std::chrono::seconds>(time).count();
|
||||
struct tm now;
|
||||
tm now;
|
||||
localtime_r(&seconds, &now);
|
||||
#ifdef OATPP_DISABLE_STD_PUT_TIME
|
||||
char timeBuffer[50];
|
||||
|
@ -81,9 +81,9 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::get() {
|
||||
|
||||
auto portStr = oatpp::utils::conversion::int32ToStr(m_address.port);
|
||||
|
||||
struct addrinfo hints;
|
||||
addrinfo hints;
|
||||
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
memset(&hints, 0, sizeof(addrinfo));
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = 0;
|
||||
hints.ai_protocol = 0;
|
||||
@ -95,7 +95,7 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::get() {
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
}
|
||||
|
||||
struct addrinfo* result;
|
||||
addrinfo* result;
|
||||
auto res = getaddrinfo(m_address.host->c_str(), portStr->c_str(), &hints, &result);
|
||||
|
||||
if (res != 0) {
|
||||
@ -112,7 +112,7 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::get() {
|
||||
throw std::runtime_error("[oatpp::network::tcp::client::ConnectionProvider::getConnection()]. Error. Call to getaddrinfo() returned no results.");
|
||||
}
|
||||
|
||||
struct addrinfo* currResult = result;
|
||||
addrinfo* currResult = result;
|
||||
oatpp::v_io_handle clientHandle = INVALID_IO_HANDLE;
|
||||
int err = 0;
|
||||
|
||||
@ -169,8 +169,8 @@ oatpp::async::CoroutineStarterForResult<const provider::ResourceHandle<data::str
|
||||
network::Address m_address;
|
||||
oatpp::v_io_handle m_clientHandle;
|
||||
private:
|
||||
struct addrinfo* m_result;
|
||||
struct addrinfo* m_currentResult;
|
||||
addrinfo* m_result;
|
||||
addrinfo* m_currentResult;
|
||||
bool m_isHandleOpened;
|
||||
public:
|
||||
|
||||
@ -193,9 +193,9 @@ oatpp::async::CoroutineStarterForResult<const provider::ResourceHandle<data::str
|
||||
|
||||
auto portStr = oatpp::utils::conversion::int32ToStr(m_address.port);
|
||||
|
||||
struct addrinfo hints;
|
||||
addrinfo hints;
|
||||
|
||||
memset(&hints, 0, sizeof(struct addrinfo));
|
||||
memset(&hints, 0, sizeof(addrinfo));
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = 0;
|
||||
hints.ai_protocol = 0;
|
||||
|
@ -243,8 +243,8 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
v_int32 ret;
|
||||
int yes = 1;
|
||||
|
||||
struct addrinfo *result = NULL;
|
||||
struct addrinfo hints;
|
||||
addrinfo *result = NULL;
|
||||
addrinfo hints;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
@ -266,7 +266,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
throw std::runtime_error("[oatpp::network::tcp::server::ConnectionProvider::instantiateServer()]: Error. Call to getaddrinfo() failed.");
|
||||
}
|
||||
|
||||
struct addrinfo* currResult = result;
|
||||
addrinfo* currResult = result;
|
||||
while(currResult != nullptr) {
|
||||
|
||||
serverHandle = socket(currResult->ai_family, currResult->ai_socktype, currResult->ai_protocol);
|
||||
@ -305,10 +305,10 @@ 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;
|
||||
::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);
|
||||
::getsockname(serverHandle, (sockaddr *)&s_in, &s_in_len);
|
||||
setProperty(PROPERTY_PORT, oatpp::utils::conversion::int32ToStr(ntohs(s_in.sin_port)));
|
||||
|
||||
return serverHandle;
|
||||
@ -348,12 +348,12 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getDefaultC
|
||||
|
||||
provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getExtendedConnection() {
|
||||
|
||||
struct sockaddr_storage clientAddress;
|
||||
sockaddr_storage clientAddress;
|
||||
socklen_t clientAddressSize = sizeof(clientAddress);
|
||||
|
||||
data::stream::Context::Properties properties;
|
||||
|
||||
oatpp::v_io_handle handle = accept(m_serverHandle, (struct sockaddr*) &clientAddress, &clientAddressSize);
|
||||
oatpp::v_io_handle handle = accept(m_serverHandle, (sockaddr*) &clientAddress, &clientAddressSize);
|
||||
|
||||
if(!oatpp::isValidIOHandle(handle)) {
|
||||
return nullptr;
|
||||
@ -362,7 +362,7 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getExtended
|
||||
if (clientAddress.ss_family == AF_INET) {
|
||||
|
||||
char strIp[INET_ADDRSTRLEN];
|
||||
struct sockaddr_in* sockAddress = (struct sockaddr_in*) &clientAddress;
|
||||
sockaddr_in* sockAddress = (sockaddr_in*) &clientAddress;
|
||||
inet_ntop(AF_INET, &sockAddress->sin_addr, strIp, INET_ADDRSTRLEN);
|
||||
|
||||
properties.put_LockFree(ExtendedConnection::PROPERTY_PEER_ADDRESS, oatpp::String((const char*) strIp));
|
||||
@ -372,7 +372,7 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getExtended
|
||||
} else if (clientAddress.ss_family == AF_INET6) {
|
||||
|
||||
char strIp[INET6_ADDRSTRLEN];
|
||||
struct sockaddr_in6* sockAddress = (struct sockaddr_in6*) &clientAddress;
|
||||
sockaddr_in6* sockAddress = (sockaddr_in6*) &clientAddress;
|
||||
inet_ntop(AF_INET6, &sockAddress->sin6_addr, strIp, INET6_ADDRSTRLEN);
|
||||
|
||||
properties.put_LockFree(ExtendedConnection::PROPERTY_PEER_ADDRESS, oatpp::String((const char*) strIp));
|
||||
@ -406,7 +406,7 @@ provider::ResourceHandle<oatpp::data::stream::IOStream> ConnectionProvider::get(
|
||||
while(!m_closed) {
|
||||
|
||||
fd_set set;
|
||||
struct timeval timeout;
|
||||
timeval timeout;
|
||||
FD_ZERO(&set);
|
||||
FD_SET(m_serverHandle, &set);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user