Merge pull request #3985 from BreadFish64/fix-warnings
core: clean up warnings
This commit is contained in:
commit
c35a251d86
36 changed files with 83 additions and 78 deletions
|
@ -79,7 +79,7 @@ std::shared_ptr<Applet> Applet::Get(Service::APT::AppletId id) {
|
|||
}
|
||||
|
||||
/// Handles updating the current Applet every time it's called.
|
||||
static void AppletUpdateEvent(u64 applet_id, int cycles_late) {
|
||||
static void AppletUpdateEvent(u64 applet_id, s64 cycles_late) {
|
||||
Service::APT::AppletId id = static_cast<Service::APT::AppletId>(applet_id);
|
||||
std::shared_ptr<Applet> applet = Applet::Get(id);
|
||||
ASSERT_MSG(applet != nullptr, "Applet doesn't exist! applet_id={:08X}", static_cast<u32>(id));
|
||||
|
|
|
@ -423,7 +423,7 @@ inline const std::vector<u8>& RequestParser::PopStaticBuffer() {
|
|||
Pop<VAddr>();
|
||||
|
||||
StaticBufferDescInfo buffer_info{sbuffer_descriptor};
|
||||
return context->GetStaticBuffer(buffer_info.buffer_id);
|
||||
return context->GetStaticBuffer(static_cast<u8>(buffer_info.buffer_id));
|
||||
}
|
||||
|
||||
inline Kernel::MappedBuffer& RequestParser::PopMappedBuffer() {
|
||||
|
|
|
@ -240,13 +240,13 @@ MappedBuffer::MappedBuffer(const Process& process, u32 descriptor, VAddr address
|
|||
void MappedBuffer::Read(void* dest_buffer, size_t offset, size_t size) {
|
||||
ASSERT(perms & IPC::R);
|
||||
ASSERT(offset + size <= this->size);
|
||||
Memory::ReadBlock(*process, address + offset, dest_buffer, size);
|
||||
Memory::ReadBlock(*process, address + static_cast<VAddr>(offset), dest_buffer, size);
|
||||
}
|
||||
|
||||
void MappedBuffer::Write(const void* src_buffer, size_t offset, size_t size) {
|
||||
ASSERT(perms & IPC::W);
|
||||
ASSERT(offset + size <= this->size);
|
||||
Memory::WriteBlock(*process, address + offset, src_buffer, size);
|
||||
Memory::WriteBlock(*process, address + static_cast<VAddr>(offset), src_buffer, size);
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
|
@ -120,7 +120,7 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
|
|||
IPC::MappedBufferDescInfo descInfo{descriptor};
|
||||
VAddr source_address = cmd_buf[i];
|
||||
|
||||
size_t size = descInfo.size;
|
||||
u32 size = static_cast<u32>(descInfo.size);
|
||||
IPC::MappedBufferPermissions permissions = descInfo.perms;
|
||||
|
||||
VAddr page_start = Common::AlignDown(source_address, Memory::PAGE_SIZE);
|
||||
|
@ -182,17 +182,18 @@ ResultCode TranslateCommandBuffer(SharedPtr<Thread> src_thread, SharedPtr<Thread
|
|||
Common::AlignUp(source_address, Memory::PAGE_SIZE) - source_address;
|
||||
// If the data fits in one page we can just copy the required size instead of the
|
||||
// entire page.
|
||||
size_t read_size = num_pages == 1 ? size : difference_to_page;
|
||||
size_t read_size = num_pages == 1 ? static_cast<size_t>(size) : difference_to_page;
|
||||
|
||||
Memory::ReadBlock(*src_process, source_address, buffer->data() + page_offset,
|
||||
read_size);
|
||||
|
||||
// Map the page into the target process' address space.
|
||||
target_address = dst_process->vm_manager
|
||||
.MapMemoryBlockToBase(
|
||||
Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE,
|
||||
buffer, 0, buffer->size(), Kernel::MemoryState::Shared)
|
||||
.Unwrap();
|
||||
target_address =
|
||||
dst_process->vm_manager
|
||||
.MapMemoryBlockToBase(Memory::IPC_MAPPING_VADDR, Memory::IPC_MAPPING_SIZE,
|
||||
buffer, 0, static_cast<u32>(buffer->size()),
|
||||
Kernel::MemoryState::Shared)
|
||||
.Unwrap();
|
||||
}
|
||||
|
||||
cmd_buf[i++] = target_address + page_offset;
|
||||
|
|
|
@ -188,7 +188,7 @@ void ExitCurrentThread() {
|
|||
* @param thread_handle The handle of the thread that's been awoken
|
||||
* @param cycles_late The number of CPU cycles that have passed since the desired wakeup time
|
||||
*/
|
||||
static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) {
|
||||
static void ThreadWakeupCallback(u64 thread_handle, s64 cycles_late) {
|
||||
SharedPtr<Thread> thread = wakeup_callback_handle_table.Get<Thread>((Handle)thread_handle);
|
||||
if (thread == nullptr) {
|
||||
LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", (Handle)thread_handle);
|
||||
|
|
|
@ -76,7 +76,7 @@ void Timer::WakeupAllWaitingThreads() {
|
|||
signaled = false;
|
||||
}
|
||||
|
||||
void Timer::Signal(int cycles_late) {
|
||||
void Timer::Signal(s64 cycles_late) {
|
||||
LOG_TRACE(Kernel, "Timer {} fired", GetObjectId());
|
||||
|
||||
signaled = true;
|
||||
|
@ -92,7 +92,7 @@ void Timer::Signal(int cycles_late) {
|
|||
}
|
||||
|
||||
/// The timer callback event, called when a timer is fired
|
||||
static void TimerCallback(u64 timer_handle, int cycles_late) {
|
||||
static void TimerCallback(u64 timer_handle, s64 cycles_late) {
|
||||
SharedPtr<Timer> timer =
|
||||
timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle));
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
* This method should not be called from outside the timer callback handler,
|
||||
* lest multiple callback events get scheduled.
|
||||
*/
|
||||
void Signal(int cycles_late);
|
||||
void Signal(s64 cycles_late);
|
||||
|
||||
private:
|
||||
Timer();
|
||||
|
|
|
@ -232,7 +232,7 @@ bool CIAFile::SetSize(u64 size) const {
|
|||
bool CIAFile::Close() const {
|
||||
bool complete = true;
|
||||
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
|
||||
if (content_written[i] < container.GetContentSize(i))
|
||||
if (content_written[i] < container.GetContentSize(static_cast<u16>(i)))
|
||||
complete = false;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ InstallStatus InstallCIA(const std::string& path,
|
|||
Service::AM::GetTitleMediaType(container.GetTitleMetadata().GetTitleID()));
|
||||
|
||||
for (size_t i = 0; i < container.GetTitleMetadata().GetContentCount(); i++) {
|
||||
if (container.GetTitleMetadata().GetContentTypeByIndex(i) &
|
||||
if (container.GetTitleMetadata().GetContentTypeByIndex(static_cast<u16>(i)) &
|
||||
FileSys::TMDContentTypeFlag::Encrypted) {
|
||||
LOG_ERROR(Service_AM, "File {} is encrypted! Aborting...", path);
|
||||
return InstallStatus::ErrorEncrypted;
|
||||
|
@ -493,7 +493,7 @@ void Module::Interface::GetNumPrograms(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push<u32>(am->am_title_list[media_type].size());
|
||||
rb.Push<u32>(static_cast<u32>(am->am_title_list[media_type].size()));
|
||||
}
|
||||
|
||||
void Module::Interface::FindDLCContentInfos(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -877,7 +877,7 @@ void Module::Interface::GetDLCContentInfoCount(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
FileSys::TitleMetadata tmd;
|
||||
if (tmd.Load(tmd_path) == Loader::ResultStatus::Success) {
|
||||
rb.Push<u32>(tmd.GetContentCount());
|
||||
rb.Push<u32>(static_cast<u32>(tmd.GetContentCount()));
|
||||
} else {
|
||||
rb.Push<u32>(1); // Number of content infos plus one
|
||||
LOG_WARNING(Service_AM, "(STUBBED) called media_type={}, title_id=0x{:016x}",
|
||||
|
|
|
@ -74,7 +74,7 @@ void Module::PortConfig::Clear() {
|
|||
transfer_bytes = 256;
|
||||
}
|
||||
|
||||
void Module::CompletionEventCallBack(u64 port_id, int) {
|
||||
void Module::CompletionEventCallBack(u64 port_id, s64) {
|
||||
PortConfig& port = ports[port_id];
|
||||
const CameraConfig& camera = cameras[port.camera_id];
|
||||
const auto buffer = port.capture_result.get();
|
||||
|
@ -1028,7 +1028,7 @@ Module::Module() {
|
|||
}
|
||||
completion_event_callback = CoreTiming::RegisterEvent(
|
||||
"CAM::CompletionEventCallBack",
|
||||
[this](u64 userdata, int cycles_late) { CompletionEventCallBack(userdata, cycles_late); });
|
||||
[this](u64 userdata, s64 cycles_late) { CompletionEventCallBack(userdata, cycles_late); });
|
||||
}
|
||||
|
||||
Module::~Module() {
|
||||
|
|
|
@ -710,7 +710,7 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
void CompletionEventCallBack(u64 port_id, int);
|
||||
void CompletionEventCallBack(u64 port_id, s64);
|
||||
|
||||
// Starts a receiving process on the specified port. This can only be called when is_busy = true
|
||||
// and is_receiving = false.
|
||||
|
|
|
@ -184,7 +184,7 @@ void Module::Interface::SecureInfoGetRegion(Kernel::HLERequestContext& ctx, u16
|
|||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push<u8>(cfg->GetRegionValue());
|
||||
rb.Push<u8>(static_cast<u8>(cfg->GetRegionValue()));
|
||||
}
|
||||
|
||||
void Module::Interface::GenHashConsoleUnique(Kernel::HLERequestContext& ctx) {
|
||||
|
|
|
@ -79,7 +79,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
if (file->subfile && length > file->size) {
|
||||
LOG_WARNING(Service_FS, "Trying to read beyond the subfile size, truncating");
|
||||
length = file->size;
|
||||
length = static_cast<u32>(file->size);
|
||||
}
|
||||
|
||||
// This file session might have a specific offset from where to start reading, apply it.
|
||||
|
@ -101,7 +101,7 @@ void File::Read(Kernel::HLERequestContext& ctx) {
|
|||
} else {
|
||||
buffer.Write(data.data(), 0, *read);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push<u32>(*read);
|
||||
rb.Push<u32>(static_cast<u32>(*read));
|
||||
}
|
||||
rb.PushMappedBuffer(buffer);
|
||||
|
||||
|
@ -142,7 +142,7 @@ void File::Write(Kernel::HLERequestContext& ctx) {
|
|||
rb.Push<u32>(0);
|
||||
} else {
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push<u32>(*written);
|
||||
rb.Push<u32>(static_cast<u32>(*written));
|
||||
}
|
||||
rb.PushMappedBuffer(buffer);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ void Module::LoadInputDevices() {
|
|||
touch_device = Input::CreateDevice<Input::TouchDevice>(Settings::values.touch_device);
|
||||
}
|
||||
|
||||
void Module::UpdatePadCallback(u64 userdata, int cycles_late) {
|
||||
void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) {
|
||||
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
|
||||
|
||||
if (is_device_reload_pending.exchange(false))
|
||||
|
@ -166,7 +166,7 @@ void Module::UpdatePadCallback(u64 userdata, int cycles_late) {
|
|||
CoreTiming::ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event);
|
||||
}
|
||||
|
||||
void Module::UpdateAccelerometerCallback(u64 userdata, int cycles_late) {
|
||||
void Module::UpdateAccelerometerCallback(u64 userdata, s64 cycles_late) {
|
||||
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
|
||||
|
||||
mem->accelerometer.index = next_accelerometer_index;
|
||||
|
@ -210,7 +210,7 @@ void Module::UpdateAccelerometerCallback(u64 userdata, int cycles_late) {
|
|||
CoreTiming::ScheduleEvent(accelerometer_update_ticks - cycles_late, accelerometer_update_event);
|
||||
}
|
||||
|
||||
void Module::UpdateGyroscopeCallback(u64 userdata, int cycles_late) {
|
||||
void Module::UpdateGyroscopeCallback(u64 userdata, s64 cycles_late) {
|
||||
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
|
||||
|
||||
mem->gyroscope.index = next_gyroscope_index;
|
||||
|
@ -371,16 +371,16 @@ Module::Module() {
|
|||
|
||||
// Register update callbacks
|
||||
pad_update_event =
|
||||
CoreTiming::RegisterEvent("HID::UpdatePadCallback", [this](u64 userdata, int cycles_late) {
|
||||
CoreTiming::RegisterEvent("HID::UpdatePadCallback", [this](u64 userdata, s64 cycles_late) {
|
||||
UpdatePadCallback(userdata, cycles_late);
|
||||
});
|
||||
accelerometer_update_event = CoreTiming::RegisterEvent(
|
||||
"HID::UpdateAccelerometerCallback", [this](u64 userdata, int cycles_late) {
|
||||
"HID::UpdateAccelerometerCallback", [this](u64 userdata, s64 cycles_late) {
|
||||
UpdateAccelerometerCallback(userdata, cycles_late);
|
||||
});
|
||||
gyroscope_update_event = CoreTiming::RegisterEvent(
|
||||
"HID::UpdateGyroscopeCallback",
|
||||
[this](u64 userdata, int cycles_late) { UpdateGyroscopeCallback(userdata, cycles_late); });
|
||||
[this](u64 userdata, s64 cycles_late) { UpdateGyroscopeCallback(userdata, cycles_late); });
|
||||
|
||||
CoreTiming::ScheduleEvent(pad_update_ticks, pad_update_event);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class SharedMemory;
|
|||
} // namespace Kernel
|
||||
|
||||
namespace CoreTiming {
|
||||
class EventType;
|
||||
struct EventType;
|
||||
};
|
||||
|
||||
namespace Service {
|
||||
|
@ -297,9 +297,9 @@ public:
|
|||
|
||||
private:
|
||||
void LoadInputDevices();
|
||||
void UpdatePadCallback(u64 userdata, int cycles_late);
|
||||
void UpdateAccelerometerCallback(u64 userdata, int cycles_late);
|
||||
void UpdateGyroscopeCallback(u64 userdata, int cycles_late);
|
||||
void UpdatePadCallback(u64 userdata, s64 cycles_late);
|
||||
void UpdateAccelerometerCallback(u64 userdata, s64 cycles_late);
|
||||
void UpdateGyroscopeCallback(u64 userdata, s64 cycles_late);
|
||||
|
||||
// Handle to shared memory region designated to HID_User service
|
||||
Kernel::SharedPtr<Kernel::SharedMemory> shared_mem;
|
||||
|
|
|
@ -146,7 +146,7 @@ ExtraHID::ExtraHID(SendFunc send_func) : IRDevice(send_func) {
|
|||
}};
|
||||
|
||||
hid_polling_callback_id =
|
||||
CoreTiming::RegisterEvent("ExtraHID::SendHIDStatus", [this](u64, int cycles_late) {
|
||||
CoreTiming::RegisterEvent("ExtraHID::SendHIDStatus", [this](u64, s64 cycles_late) {
|
||||
SendHIDStatus();
|
||||
CoreTiming::ScheduleEvent(msToCycles(hid_period) - cycles_late,
|
||||
hid_polling_callback_id);
|
||||
|
|
|
@ -48,7 +48,7 @@ void IR_RST::UnloadInputDevices() {
|
|||
c_stick = nullptr;
|
||||
}
|
||||
|
||||
void IR_RST::UpdateCallback(u64 userdata, int cycles_late) {
|
||||
void IR_RST::UpdateCallback(u64 userdata, s64 cycles_late) {
|
||||
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_memory->GetPointer());
|
||||
|
||||
if (is_device_reload_pending.exchange(false))
|
||||
|
@ -155,7 +155,7 @@ IR_RST::IR_RST() : ServiceFramework("ir:rst", 1) {
|
|||
update_event = Event::Create(ResetType::OneShot, "IRRST:UpdateEvent");
|
||||
|
||||
update_callback_id =
|
||||
CoreTiming::RegisterEvent("IRRST:UpdateCallBack", [this](u64 userdata, int cycles_late) {
|
||||
CoreTiming::RegisterEvent("IRRST:UpdateCallBack", [this](u64 userdata, s64 cycles_late) {
|
||||
UpdateCallback(userdata, cycles_late);
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class SharedMemory;
|
|||
} // namespace Kernel
|
||||
|
||||
namespace CoreTiming {
|
||||
class EventType;
|
||||
struct EventType;
|
||||
};
|
||||
|
||||
namespace Service {
|
||||
|
@ -76,7 +76,7 @@ private:
|
|||
|
||||
void LoadInputDevices();
|
||||
void UnloadInputDevices();
|
||||
void UpdateCallback(u64 userdata, int cycles_late);
|
||||
void UpdateCallback(u64 userdata, s64 cycles_late);
|
||||
|
||||
Kernel::SharedPtr<Kernel::Event> update_event;
|
||||
Kernel::SharedPtr<Kernel::SharedMemory> shared_memory;
|
||||
|
|
|
@ -15,7 +15,7 @@ class SharedMemory;
|
|||
} // namespace Kernel
|
||||
|
||||
namespace CoreTiming {
|
||||
class EventType;
|
||||
struct EventType;
|
||||
};
|
||||
|
||||
namespace Service {
|
||||
|
|
|
@ -80,7 +80,7 @@ static u8 network_channel = DefaultNetworkChannel;
|
|||
static NetworkInfo network_info;
|
||||
|
||||
// Mapping of mac addresses to their respective node_ids.
|
||||
static std::map<MacAddress, u32> node_map;
|
||||
static std::map<MacAddress, u16> node_map;
|
||||
|
||||
// Event that will generate and send the 802.11 beacon frames.
|
||||
static CoreTiming::EventType* beacon_broadcast_event;
|
||||
|
@ -179,7 +179,7 @@ static void HandleNodeMapPacket(const Network::WifiPacket& packet) {
|
|||
node_map.clear();
|
||||
size_t num_entries;
|
||||
Network::MacAddress address;
|
||||
u32 id;
|
||||
u16 id;
|
||||
std::memcpy(&num_entries, packet.data.data(), sizeof(num_entries));
|
||||
size_t offset = sizeof(num_entries);
|
||||
for (size_t i = 0; i < num_entries; ++i) {
|
||||
|
@ -612,7 +612,7 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
|
|||
}
|
||||
|
||||
// Update the total size in the structure and write it to the buffer again.
|
||||
data_reply_header.total_size = cur_buffer_size;
|
||||
data_reply_header.total_size = static_cast<u32>(cur_buffer_size);
|
||||
out_buffer.Write(&data_reply_header, 0, sizeof(BeaconDataReplyHeader));
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||
|
@ -1189,7 +1189,7 @@ void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) {
|
|||
return;
|
||||
}
|
||||
|
||||
network_info.application_data_size = size;
|
||||
network_info.application_data_size = static_cast<u8>(size);
|
||||
std::memcpy(network_info.application_data.data(), application_data.data(), size);
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
@ -1262,7 +1262,7 @@ void NWM_UDS::DecryptBeaconData(Kernel::HLERequestContext& ctx) {
|
|||
}
|
||||
|
||||
// Sends a 802.11 beacon frame with information about the current network.
|
||||
static void BeaconBroadcastCallback(u64 userdata, int cycles_late) {
|
||||
static void BeaconBroadcastCallback(u64 userdata, s64 cycles_late) {
|
||||
// Don't do anything if we're not actually hosting a network
|
||||
if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost))
|
||||
return;
|
||||
|
|
|
@ -77,7 +77,6 @@ void Module::Interface::GetStepHistory(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
u32 hours = rp.Pop<u32>();
|
||||
u64 start_time = rp.Pop<u64>();
|
||||
size_t steps_buff_size;
|
||||
auto& buffer = rp.PopMappedBuffer();
|
||||
ASSERT_MSG(sizeof(u16) * hours == buffer.GetSize(),
|
||||
"Buffer for steps count has incorrect size");
|
||||
|
|
|
@ -796,8 +796,8 @@ void SOC_U::SetSockOpt(Kernel::HLERequestContext& ctx) {
|
|||
#endif
|
||||
} else {
|
||||
const char* optval_data = reinterpret_cast<const char*>(optval.data());
|
||||
err = static_cast<u32>(
|
||||
::setsockopt(socket_handle, level, optname, optval_data, optval.size()));
|
||||
err = static_cast<u32>(::setsockopt(socket_handle, level, optname, optval_data,
|
||||
static_cast<socklen_t>(optval.size())));
|
||||
if (err == SOCKET_ERROR_VALUE) {
|
||||
err = TranslateError(GET_ERRNO);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ static u64 GetSystemTime() {
|
|||
return console_time;
|
||||
}
|
||||
|
||||
static void UpdateTimeCallback(u64 userdata, int cycles_late) {
|
||||
static void UpdateTimeCallback(u64 userdata, s64 cycles_late) {
|
||||
DateTime& date_time =
|
||||
shared_page.date_time_counter % 2 ? shared_page.date_time_0 : shared_page.date_time_1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue