mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-28 07:21:02 +00:00
Fix most conversion warnings
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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!
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user