summaryrefslogtreecommitdiff
path: root/src/core/network
diff options
context:
space:
mode:
authorGravatar Lioncash2020-10-13 08:10:50 -0400
committerGravatar Lioncash2020-10-13 13:16:49 -0400
commit39c8d18feba8eafcd43fbb55e73ae150a1947aad (patch)
tree9565ff464bbb9e5a0aa66e6e310098314e88d019 /src/core/network
parentMerge pull request #3929 from FearlessTobi/ticket-keys (diff)
downloadyuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.tar.gz
yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.tar.xz
yuzu-39c8d18feba8eafcd43fbb55e73ae150a1947aad.zip
core/CMakeLists: Make some warnings errors
Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors.
Diffstat (limited to 'src/core/network')
-rw-r--r--src/core/network/network.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/core/network/network.cpp b/src/core/network/network.cpp
index 56d173b5e..4b3bb4366 100644
--- a/src/core/network/network.cpp
+++ b/src/core/network/network.cpp
@@ -238,14 +238,14 @@ SockAddrIn TranslateToSockAddrIn(sockaddr input_) {
238 return result; 238 return result;
239} 239}
240 240
241u16 TranslatePollEvents(u16 events) { 241u16 TranslatePollEvents(u32 events) {
242 u16 result = 0; 242 u32 result = 0;
243 243
244 if (events & POLL_IN) { 244 if ((events & POLL_IN) != 0) {
245 events &= ~POLL_IN; 245 events &= ~POLL_IN;
246 result |= POLLIN; 246 result |= POLLIN;
247 } 247 }
248 if (events & POLL_PRI) { 248 if ((events & POLL_PRI) != 0) {
249 events &= ~POLL_PRI; 249 events &= ~POLL_PRI;
250#ifdef _WIN32 250#ifdef _WIN32
251 LOG_WARNING(Service, "Winsock doesn't support POLLPRI"); 251 LOG_WARNING(Service, "Winsock doesn't support POLLPRI");
@@ -253,20 +253,20 @@ u16 TranslatePollEvents(u16 events) {
253 result |= POLL_PRI; 253 result |= POLL_PRI;
254#endif 254#endif
255 } 255 }
256 if (events & POLL_OUT) { 256 if ((events & POLL_OUT) != 0) {
257 events &= ~POLL_OUT; 257 events &= ~POLL_OUT;
258 result |= POLLOUT; 258 result |= POLLOUT;
259 } 259 }
260 260
261 UNIMPLEMENTED_IF_MSG(events != 0, "Unhandled guest events=0x{:x}", events); 261 UNIMPLEMENTED_IF_MSG(events != 0, "Unhandled guest events=0x{:x}", events);
262 262
263 return result; 263 return static_cast<u16>(result);
264} 264}
265 265
266u16 TranslatePollRevents(u16 revents) { 266u16 TranslatePollRevents(u32 revents) {
267 u16 result = 0; 267 u32 result = 0;
268 const auto translate = [&result, &revents](int host, unsigned guest) { 268 const auto translate = [&result, &revents](u32 host, u32 guest) {
269 if (revents & host) { 269 if ((revents & host) != 0) {
270 revents &= ~host; 270 revents &= ~host;
271 result |= guest; 271 result |= guest;
272 } 272 }
@@ -280,7 +280,7 @@ u16 TranslatePollRevents(u16 revents) {
280 280
281 UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents=0x{:x}", revents); 281 UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents=0x{:x}", revents);
282 282
283 return result; 283 return static_cast<u16>(result);
284} 284}
285 285
286template <typename T> 286template <typename T>
@@ -350,7 +350,7 @@ std::pair<s32, Errno> Poll(std::vector<PollFD>& pollfds, s32 timeout) {
350 } 350 }
351 351
352 for (size_t i = 0; i < num; ++i) { 352 for (size_t i = 0; i < num; ++i) {
353 pollfds[i].revents = TranslatePollRevents(host_pollfds[i].revents); 353 pollfds[i].revents = TranslatePollRevents(static_cast<u32>(host_pollfds[i].revents));
354 } 354 }
355 355
356 if (result > 0) { 356 if (result > 0) {
@@ -408,7 +408,7 @@ std::pair<Socket::AcceptResult, Errno> Socket::Accept() {
408 408
409Errno Socket::Connect(SockAddrIn addr_in) { 409Errno Socket::Connect(SockAddrIn addr_in) {
410 const sockaddr host_addr_in = TranslateFromSockAddrIn(addr_in); 410 const sockaddr host_addr_in = TranslateFromSockAddrIn(addr_in);
411 if (connect(fd, &host_addr_in, sizeof(host_addr_in)) != INVALID_SOCKET) { 411 if (connect(fd, &host_addr_in, sizeof(host_addr_in)) != SOCKET_ERROR) {
412 return Errno::SUCCESS; 412 return Errno::SUCCESS;
413 } 413 }
414 414
@@ -503,10 +503,10 @@ std::pair<s32, Errno> Socket::Recv(int flags, std::vector<u8>& message) {
503 ASSERT(flags == 0); 503 ASSERT(flags == 0);
504 ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); 504 ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
505 505
506 const int result = 506 const auto result =
507 recv(fd, reinterpret_cast<char*>(message.data()), static_cast<int>(message.size()), 0); 507 recv(fd, reinterpret_cast<char*>(message.data()), static_cast<int>(message.size()), 0);
508 if (result != SOCKET_ERROR) { 508 if (result != SOCKET_ERROR) {
509 return {result, Errno::SUCCESS}; 509 return {static_cast<s32>(result), Errno::SUCCESS};
510 } 510 }
511 511
512 switch (const int ec = LastError()) { 512 switch (const int ec = LastError()) {
@@ -531,14 +531,14 @@ std::pair<s32, Errno> Socket::RecvFrom(int flags, std::vector<u8>& message, Sock
531 socklen_t* const p_addrlen = addr ? &addrlen : nullptr; 531 socklen_t* const p_addrlen = addr ? &addrlen : nullptr;
532 sockaddr* const p_addr_in = addr ? &addr_in : nullptr; 532 sockaddr* const p_addr_in = addr ? &addr_in : nullptr;
533 533
534 const int result = recvfrom(fd, reinterpret_cast<char*>(message.data()), 534 const auto result = recvfrom(fd, reinterpret_cast<char*>(message.data()),
535 static_cast<int>(message.size()), 0, p_addr_in, p_addrlen); 535 static_cast<int>(message.size()), 0, p_addr_in, p_addrlen);
536 if (result != SOCKET_ERROR) { 536 if (result != SOCKET_ERROR) {
537 if (addr) { 537 if (addr) {
538 ASSERT(addrlen == sizeof(addr_in)); 538 ASSERT(addrlen == sizeof(addr_in));
539 *addr = TranslateToSockAddrIn(addr_in); 539 *addr = TranslateToSockAddrIn(addr_in);
540 } 540 }
541 return {result, Errno::SUCCESS}; 541 return {static_cast<s32>(result), Errno::SUCCESS};
542 } 542 }
543 543
544 switch (const int ec = LastError()) { 544 switch (const int ec = LastError()) {
@@ -558,10 +558,10 @@ std::pair<s32, Errno> Socket::Send(const std::vector<u8>& message, int flags) {
558 ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); 558 ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
559 ASSERT(flags == 0); 559 ASSERT(flags == 0);
560 560
561 const int result = send(fd, reinterpret_cast<const char*>(message.data()), 561 const auto result = send(fd, reinterpret_cast<const char*>(message.data()),
562 static_cast<int>(message.size()), 0); 562 static_cast<int>(message.size()), 0);
563 if (result != SOCKET_ERROR) { 563 if (result != SOCKET_ERROR) {
564 return {result, Errno::SUCCESS}; 564 return {static_cast<s32>(result), Errno::SUCCESS};
565 } 565 }
566 566
567 const int ec = LastError(); 567 const int ec = LastError();
@@ -591,10 +591,10 @@ std::pair<s32, Errno> Socket::SendTo(u32 flags, const std::vector<u8>& message,
591 to = &host_addr_in; 591 to = &host_addr_in;
592 } 592 }
593 593
594 const int result = sendto(fd, reinterpret_cast<const char*>(message.data()), 594 const auto result = sendto(fd, reinterpret_cast<const char*>(message.data()),
595 static_cast<int>(message.size()), 0, to, tolen); 595 static_cast<int>(message.size()), 0, to, tolen);
596 if (result != SOCKET_ERROR) { 596 if (result != SOCKET_ERROR) {
597 return {result, Errno::SUCCESS}; 597 return {static_cast<s32>(result), Errno::SUCCESS};
598 } 598 }
599 599
600 const int ec = LastError(); 600 const int ec = LastError();