Fix some compilation warnings

This commit is contained in:
momo5502
2025-01-05 19:27:17 +01:00
parent 4f444a7227
commit 3f00cdb181
5 changed files with 19 additions and 4 deletions

View File

@@ -68,10 +68,10 @@ namespace network
bool socket::send(const address& target, const void* data, const size_t size) const
{
const int res = sendto(this->socket_, static_cast<const char*>(data), static_cast<int>(size), 0,
const auto res = sendto(this->socket_, static_cast<const char*>(data), static_cast<send_size>(size), 0,
&target.get_addr(),
target.get_size());
return res == static_cast<int>(size);
static_cast<socklen_t>(target.get_size()));
return static_cast<size_t>(res) == size;
}
bool socket::send(const address& target, const std::string& data) const

View File

@@ -7,11 +7,13 @@
#ifdef _WIN32
using socklen_t = int;
using send_size = int;
#define GET_SOCKET_ERROR() (WSAGetLastError())
#define poll WSAPoll
#define SOCK_WOULDBLOCK WSAEWOULDBLOCK
#else
using SOCKET = int;
using send_size = ssize_t;
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR (-1)
#define GET_SOCKET_ERROR() (errno)

View File

@@ -1,8 +1,12 @@
#pragma once
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable: 4201) // nameless struct/union
#pragma warning(disable: 4702) // unreachable code
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include "compiler.hpp"
@@ -21,7 +25,7 @@
#include "threading.hpp"
#ifdef OS_WINDOWS
#pragma comment(lib, "ntdll")
#pragma comment(lib, "ntdll")
extern "C"
{
@@ -37,4 +41,7 @@ extern "C"
_Out_opt_ PULONG ReturnLength
);
}
#pragma warning(pop)
#else
#pragma GCC diagnostic pop
#endif

View File

@@ -1,7 +1,9 @@
#pragma once
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4505)
#endif
#ifdef __clang__
#pragma GCC diagnostic push
@@ -15,7 +17,9 @@
#pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include <stdexcept>

View File

@@ -174,6 +174,8 @@ void forward_syscall(const syscall_context& c, NTSTATUS (*handler)(const syscall
resolve_indexed_argument<std::remove_cv_t<std::remove_reference_t<Args>>>(c.emu, index)...
};
(void)index;
const auto ret = std::apply(handler, std::move(func_args));
write_status(c, ret, ip);
}