Fix macOS warnings

This commit is contained in:
momo5502
2025-01-05 20:14:53 +01:00
parent a8b4b69a8b
commit eeac915a55
4 changed files with 5 additions and 4 deletions

View File

@@ -21,7 +21,7 @@
#include <cstring>
#define ZeroMemory(x, y) memset(x, 0, y)
#define ZeroMemory(x, y) memset(x, 0, static_cast<size_t>(y))
#endif

View File

@@ -57,7 +57,7 @@ namespace network
bool socket::bind_port(const address& target)
{
const auto result = bind(this->socket_, &target.get_addr(), target.get_size()) == 0;
const auto result = bind(this->socket_, &target.get_addr(), static_cast<socklen_t>(target.get_size())) == 0;
if (result)
{
this->port_ = target.get_port();
@@ -82,7 +82,7 @@ namespace network
bool socket::receive(address& source, std::string& data) const
{
char buffer[0x2000];
socklen_t len = source.get_max_size();
auto len = static_cast<socklen_t>(source.get_max_size());
const auto result = recvfrom(this->socket_, buffer, static_cast<int>(sizeof(buffer)), 0, &source.get_addr(),
&len);

View File

@@ -13,7 +13,7 @@ using send_size = int;
#define SOCK_WOULDBLOCK WSAEWOULDBLOCK
#else
using SOCKET = int;
using send_size = ssize_t;
using send_size = size_t;
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR (-1)
#define GET_SOCKET_ERROR() (errno)

View File

@@ -97,6 +97,7 @@ namespace utils
const std::span result(this->buffer_.data() + this->offset_, length);
this->offset_ += length;
(void)this->no_debugging_;
#ifndef NDEBUG
if (!this->no_debugging_)