mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-11 13:20:04 +00:00
Chore: Enable warnings as errors on MSVC (#6456)
* tests: add Sanity test for SplitFilename83 fix test fix test * disable `C4715:not all control paths return a value` for nihstro includes nihstro: no warn * Chore: Enable warnings as errors on msvc + fix warnings fixes some more warnings clang-format * more fixes * Externals: Add target_compile_options `/W0` nihstro-headers and ... Revert "disable `C4715:not all control paths return a value` for nihstro includes" This reverts commit 606d79b55d3044b744fb835025b8eb0f4ea5b757. * src\citra\config.cpp: ReadSetting: simplify type casting * settings.cpp: Get*Name: remove superflous logs
This commit is contained in:
parent
055a58f01e
commit
41f13456c0
71 changed files with 397 additions and 294 deletions
|
@ -24,8 +24,8 @@ public:
|
|||
std::string GetName() const override {
|
||||
return name;
|
||||
}
|
||||
void SetName(const std::string& name) {
|
||||
this->name = name;
|
||||
void SetName(const std::string& name_) {
|
||||
name = name_;
|
||||
}
|
||||
|
||||
static constexpr HandleType HANDLE_TYPE = HandleType::Event;
|
||||
|
|
|
@ -238,13 +238,14 @@ ResultVal<VAddr> Process::HeapAllocate(VAddr target, u32 size, VMAPermission per
|
|||
return ERR_INVALID_ADDRESS;
|
||||
}
|
||||
}
|
||||
|
||||
auto vma = vm_manager.FindVMA(target);
|
||||
if (vma->second.type != VMAType::Free || vma->second.base + vma->second.size < target + size) {
|
||||
LOG_ERROR(Kernel, "Trying to allocate already allocated memory");
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
{
|
||||
auto vma = vm_manager.FindVMA(target);
|
||||
if (vma->second.type != VMAType::Free ||
|
||||
vma->second.base + vma->second.size < target + size) {
|
||||
LOG_ERROR(Kernel, "Trying to allocate already allocated memory");
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
}
|
||||
}
|
||||
|
||||
auto allocated_fcram = memory_region->HeapAllocate(size);
|
||||
if (allocated_fcram.empty()) {
|
||||
LOG_ERROR(Kernel, "Not enough space");
|
||||
|
|
|
@ -157,14 +157,16 @@ ResultCode SharedMemory::Map(Process& target_process, VAddr address, MemoryPermi
|
|||
// APT:GetSharedFont for detail.
|
||||
target_address = linear_heap_phys_offset + Memory::LINEAR_HEAP_VADDR;
|
||||
}
|
||||
|
||||
auto vma = target_process.vm_manager.FindVMA(target_address);
|
||||
if (vma->second.type != VMAType::Free ||
|
||||
vma->second.base + vma->second.size < target_address + size) {
|
||||
LOG_ERROR(Kernel,
|
||||
"cannot map id={}, address=0x{:08X} name={}, mapping to already allocated memory",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
{
|
||||
auto vma = target_process.vm_manager.FindVMA(target_address);
|
||||
if (vma->second.type != VMAType::Free ||
|
||||
vma->second.base + vma->second.size < target_address + size) {
|
||||
LOG_ERROR(
|
||||
Kernel,
|
||||
"cannot map id={}, address=0x{:08X} name={}, mapping to already allocated memory",
|
||||
GetObjectId(), address, name);
|
||||
return ERR_INVALID_ADDRESS_STATE;
|
||||
}
|
||||
}
|
||||
|
||||
// Map the memory block into the target process
|
||||
|
|
|
@ -28,8 +28,8 @@ public:
|
|||
std::string GetName() const override {
|
||||
return name;
|
||||
}
|
||||
void SetName(std::string name) {
|
||||
this->name = std::move(name);
|
||||
void SetName(std::string name_) {
|
||||
name = std::move(name_);
|
||||
}
|
||||
|
||||
static constexpr HandleType HANDLE_TYPE = HandleType::SharedMemory;
|
||||
|
|
|
@ -1962,7 +1962,7 @@ ResultCode SVC::GetProcessList(s32* process_count, VAddr out_process_array,
|
|||
}
|
||||
|
||||
s32 written = 0;
|
||||
for (const auto process : kernel.GetProcessList()) {
|
||||
for (const auto& process : kernel.GetProcessList()) {
|
||||
if (written >= out_process_array_count) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -115,8 +115,8 @@ public:
|
|||
*/
|
||||
const std::vector<std::shared_ptr<Thread>>& GetThreadList();
|
||||
|
||||
void SetCPU(ARM_Interface& cpu) {
|
||||
this->cpu = &cpu;
|
||||
void SetCPU(ARM_Interface& cpu_) {
|
||||
cpu = &cpu_;
|
||||
}
|
||||
|
||||
std::unique_ptr<ARM_Interface::ThreadContext> NewContext() {
|
||||
|
|
|
@ -1197,8 +1197,8 @@ static void CaptureFrameBuffer(Core::System& system, u32 capture_offset, VAddr s
|
|||
auto dst_vaddr = screen_capture_base_vaddr + capture_offset;
|
||||
auto dst_ptr = system.Memory().GetPointer(dst_vaddr);
|
||||
const auto src_ptr = system.Memory().GetPointer(src);
|
||||
for (auto y = 0; y < height; y++) {
|
||||
for (auto x = 0; x < screen_width; x++) {
|
||||
for (u32 y = 0; y < height; y++) {
|
||||
for (u32 x = 0; x < screen_width; x++) {
|
||||
auto dst_offset =
|
||||
VideoCore::GetMortonOffset(x, y, bpp) + (y & ~7) * screen_width_pow2 * bpp;
|
||||
auto src_offset = bpp * (screen_width * y + x);
|
||||
|
|
|
@ -929,7 +929,7 @@ void Module::APTInterface::StoreSysMenuArg(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
void Module::APTInterface::SendCaptureBufferInfo(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x40, 1, 2); // 0x00400042
|
||||
const auto size = rp.Pop<u32>();
|
||||
[[maybe_unused]] const auto size = rp.Pop<u32>();
|
||||
const auto buffer = rp.PopStaticBuffer();
|
||||
|
||||
LOG_DEBUG(Service_APT, "called");
|
||||
|
|
|
@ -855,7 +855,7 @@ ResultVal<u16> FS_USER::GetSpecialContentIndexFromGameCard(u64 title_id, Special
|
|||
case SpecialContentType::DLPChild:
|
||||
return MakeResult(static_cast<u16>(NCSDContentIndex::DLP));
|
||||
default:
|
||||
ASSERT(false);
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1424,8 +1424,8 @@ void NWM_UDS::DecryptBeaconData(Kernel::HLERequestContext& ctx, u16 command_id)
|
|||
auto& node = nodes.emplace_back();
|
||||
node.friend_code_seed = info.friend_code_seed;
|
||||
node.network_node_id = info.network_node_id;
|
||||
for (std::size_t i = 0; i < info.username.size(); ++i) {
|
||||
node.username[i] = info.username[i];
|
||||
for (std::size_t j = 0; j < info.username.size(); ++j) {
|
||||
node.username[j] = info.username[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ static std::array<u8, CryptoPP::Weak::MD5::DIGESTSIZE> GetDataCryptoCTR(
|
|||
* Generates the key used for encrypting the 802.11 data frames generated by UDS.
|
||||
* @returns The key used for data frames crypto.
|
||||
*/
|
||||
static std::array<u8, CryptoPP::AES::BLOCKSIZE> GenerateDataCCMPKey(
|
||||
[[maybe_unused]] static std::array<u8, CryptoPP::AES::BLOCKSIZE> GenerateDataCCMPKey(
|
||||
const std::vector<u8>& passphrase, const NetworkInfo& network_info) {
|
||||
// Calculate the MD5 hash of the input passphrase.
|
||||
std::array<u8, CryptoPP::Weak::MD5::DIGESTSIZE> passphrase_hash;
|
||||
|
@ -157,11 +157,10 @@ static std::vector<u8> GenerateCCMPAAD(const MacAddress& sender, const MacAddres
|
|||
* Decrypts the payload of an encrypted 802.11 data frame using the specified key.
|
||||
* @returns The decrypted payload.
|
||||
*/
|
||||
static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload,
|
||||
const std::array<u8, CryptoPP::AES::BLOCKSIZE>& ccmp_key,
|
||||
const MacAddress& sender, const MacAddress& receiver,
|
||||
const MacAddress& bssid, u16 sequence_number,
|
||||
u16 frame_control) {
|
||||
[[maybe_unused]] static std::vector<u8> DecryptDataFrame(
|
||||
const std::vector<u8>& encrypted_payload,
|
||||
const std::array<u8, CryptoPP::AES::BLOCKSIZE>& ccmp_key, const MacAddress& sender,
|
||||
const MacAddress& receiver, const MacAddress& bssid, u16 sequence_number, u16 frame_control) {
|
||||
|
||||
// Reference: IEEE 802.11-2007
|
||||
|
||||
|
@ -218,11 +217,10 @@ static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload
|
|||
* Encrypts the payload of an 802.11 data frame using the specified key.
|
||||
* @returns The encrypted payload.
|
||||
*/
|
||||
static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
|
||||
const std::array<u8, CryptoPP::AES::BLOCKSIZE>& ccmp_key,
|
||||
const MacAddress& sender, const MacAddress& receiver,
|
||||
const MacAddress& bssid, u16 sequence_number,
|
||||
u16 frame_control) {
|
||||
[[maybe_unused]] static std::vector<u8> EncryptDataFrame(
|
||||
const std::vector<u8>& payload, const std::array<u8, CryptoPP::AES::BLOCKSIZE>& ccmp_key,
|
||||
const MacAddress& sender, const MacAddress& receiver, const MacAddress& bssid,
|
||||
u16 sequence_number, u16 frame_control) {
|
||||
// Reference: IEEE 802.11-2007
|
||||
|
||||
std::vector<u8> aad = GenerateCCMPAAD(sender, receiver, bssid, frame_control);
|
||||
|
|
|
@ -99,7 +99,7 @@ void PLG_LDR::OnProcessRun(Kernel::Process& process, Kernel::KernelSystem& kerne
|
|||
plugin_root + fmt::format("{:016X}", process.codeset->program_id);
|
||||
FileUtil::FSTEntry entry;
|
||||
FileUtil::ScanDirectoryTree(plugin_tid, entry);
|
||||
for (const auto child : entry.children) {
|
||||
for (const auto& child : entry.children) {
|
||||
if (!child.isDirectory && child.physicalName.ends_with(".3gx")) {
|
||||
plgldr_context.is_default_path = false;
|
||||
plgldr_context.plugin_path = child.physicalName;
|
||||
|
|
|
@ -794,8 +794,6 @@ void SOC_U::Poll(Kernel::HLERequestContext& ctx) {
|
|||
ret = TranslateError(GET_ERRNO);
|
||||
}
|
||||
|
||||
size_t test = platform_pollfd.size();
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(ret);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue