Fix most conversion warnings

This commit is contained in:
momo5502
2025-01-05 20:34:54 +01:00
parent eeac915a55
commit 17860edc4c
9 changed files with 34 additions and 39 deletions

View File

@@ -354,7 +354,7 @@ namespace
}
const auto* address = reinterpret_cast<const sockaddr*>(data.data() + address_offset);
const auto address_size = static_cast<int>(data.size() - address_offset);
const auto address_size = static_cast<socklen_t>(data.size() - address_offset);
const network::address addr(address, address_size);
@@ -451,18 +451,13 @@ namespace
return STATUS_INVALID_PARAMETER;
}
int fromlength = static_cast<int>(address.size());
auto fromlength = static_cast<socklen_t>(address.size());
std::vector<char> data{};
data.resize(buffer.len);
#ifdef OS_WINDOWS
const auto recevied_data = recvfrom(*this->s_, data.data(), static_cast<int>(data.size()), 0,
const auto recevied_data = recvfrom(*this->s_, data.data(), static_cast<send_size>(data.size()), 0,
reinterpret_cast<sockaddr*>(address.data()), &fromlength);
#else
const auto recevied_data = recvfrom(*this->s_, data.data(), static_cast<int>(data.size()), 0,
reinterpret_cast<sockaddr*>(address.data()), (socklen_t*)&fromlength);
#endif
if (recevied_data < 0)
{
@@ -508,15 +503,15 @@ namespace
const auto buffer = emu.read_memory<EMU_WSABUF<EmulatorTraits<Emu64>>>(send_info.BufferArray);
const auto address = emu.read_memory(send_info.TdiConnInfo.RemoteAddress,
send_info.TdiConnInfo.RemoteAddressLength);
static_cast<size_t>(send_info.TdiConnInfo.RemoteAddressLength));
const network::address target(reinterpret_cast<const sockaddr*>(address.data()),
static_cast<int>(address.size()));
static_cast<socklen_t>(address.size()));
const auto data = emu.read_memory(buffer.buf, buffer.len);
const auto sent_data = sendto(*this->s_, reinterpret_cast<const char*>(data.data()),
static_cast<int>(data.size()), 0 /* ? */, &target.get_addr(),
static_cast<send_size>(data.size()), 0 /* ? */, &target.get_addr(),
target.get_size());
if (sent_data < 0)

View File

@@ -183,7 +183,7 @@ void kusd_mmio::update()
if (this->use_relative_time_)
{
const auto passed_time = this->process_->executed_instructions;
const auto clock_frequency = this->kusd_.QpcFrequency;
const auto clock_frequency = static_cast<uint64_t>(this->kusd_.QpcFrequency);
using duration = std::chrono::system_clock::duration;
time += duration(passed_time * duration::period::den / clock_frequency);
@@ -209,7 +209,7 @@ void kusd_mmio::register_mmio()
[this](const uint64_t addr, const size_t size)
{
return this->read(addr, size);
}, [this](const uint64_t, const size_t, const uint64_t)
}, [](const uint64_t, const size_t, const uint64_t)
{
// Writing not supported!
});

View File

@@ -21,7 +21,7 @@ inline std::string get_permission_string(const memory_permission permission)
inline memory_permission map_nt_to_emulator_protection(uint32_t nt_protection)
{
nt_protection &= ~PAGE_GUARD; // TODO: Implement that
nt_protection &= ~static_cast<uint32_t>(PAGE_GUARD); // TODO: Implement that
switch (nt_protection)
{

View File

@@ -118,7 +118,7 @@ namespace
const auto entry = entries.get(i);
const int type = entry >> 12;
const int offset = entry & 0xfff;
const auto offset = static_cast<uint16_t>(entry & 0xfff);
const auto total_offset = relocation.VirtualAddress + offset;
switch (type)

View File

@@ -273,7 +273,7 @@ inline std::chrono::system_clock::time_point convert_from_ksystem_time(const vol
}
#ifndef OS_WINDOWS
using __time64_t = uint64_t;
using __time64_t = int64_t;
#endif
inline LARGE_INTEGER convert_unix_to_windows_time(const __time64_t unix_time)