Merge pull request #3985 from BreadFish64/fix-warnings

core: clean up warnings
This commit is contained in:
James Rowe 2018-08-02 11:14:57 -06:00 committed by GitHub
commit c35a251d86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 83 additions and 78 deletions

View file

@ -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}",

View file

@ -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() {

View file

@ -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.

View file

@ -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) {

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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);

View file

@ -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);
});

View file

@ -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;

View file

@ -15,7 +15,7 @@ class SharedMemory;
} // namespace Kernel
namespace CoreTiming {
class EventType;
struct EventType;
};
namespace Service {

View file

@ -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;

View file

@ -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");

View file

@ -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);
}