From be1954e04cb5a0c3a526f78ed5490a5e65310280 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Oct 2020 14:49:45 -0400 Subject: core: Fix clang build Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795 --- src/core/file_sys/nca_patch.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core/file_sys/nca_patch.cpp') diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp index 5990a2fd5..6d3472447 100644 --- a/src/core/file_sys/nca_patch.cpp +++ b/src/core/file_sys/nca_patch.cpp @@ -25,9 +25,9 @@ std::pair SearchBucketEntry(u64 offset, const BlockTyp ASSERT_MSG(offset <= block.size, "Offset is out of bounds in BKTR relocation block."); } - std::size_t bucket_id = std::count_if( + const auto bucket_id = static_cast(std::count_if( block.base_offsets.begin() + 1, block.base_offsets.begin() + block.number_buckets, - [&offset](u64 base_offset) { return base_offset <= offset; }); + [&offset](u64 base_offset) { return base_offset <= offset; })); const auto& bucket = buckets[bucket_id]; @@ -53,6 +53,7 @@ std::pair SearchBucketEntry(u64 offset, const BlockTyp } UNREACHABLE_MSG("Offset could not be found in BKTR block."); + return {}; } } // Anonymous namespace @@ -136,7 +137,7 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const { const auto block_offset = section_offset & 0xF; if (block_offset != 0) { - auto block = bktr_romfs->ReadBytes(0x10, section_offset & ~0xF); + auto block = bktr_romfs->ReadBytes(0x10, section_offset & ~0xFU); cipher.Transcode(block.data(), block.size(), block.data(), Core::Crypto::Op::Decrypt); if (length + block_offset < 0x10) { std::memcpy(data, block.data() + block_offset, std::min(length, block.size())); -- cgit v1.2.3 From 3d592972dc3fd61cc88771b889eff237e4e03e0f Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 20 Oct 2020 19:07:39 -0700 Subject: Revert "core: Fix clang build" --- src/core/file_sys/nca_patch.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/core/file_sys/nca_patch.cpp') diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp index 6d3472447..5990a2fd5 100644 --- a/src/core/file_sys/nca_patch.cpp +++ b/src/core/file_sys/nca_patch.cpp @@ -25,9 +25,9 @@ std::pair SearchBucketEntry(u64 offset, const BlockTyp ASSERT_MSG(offset <= block.size, "Offset is out of bounds in BKTR relocation block."); } - const auto bucket_id = static_cast(std::count_if( + std::size_t bucket_id = std::count_if( block.base_offsets.begin() + 1, block.base_offsets.begin() + block.number_buckets, - [&offset](u64 base_offset) { return base_offset <= offset; })); + [&offset](u64 base_offset) { return base_offset <= offset; }); const auto& bucket = buckets[bucket_id]; @@ -53,7 +53,6 @@ std::pair SearchBucketEntry(u64 offset, const BlockTyp } UNREACHABLE_MSG("Offset could not be found in BKTR block."); - return {}; } } // Anonymous namespace @@ -137,7 +136,7 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const { const auto block_offset = section_offset & 0xF; if (block_offset != 0) { - auto block = bktr_romfs->ReadBytes(0x10, section_offset & ~0xFU); + auto block = bktr_romfs->ReadBytes(0x10, section_offset & ~0xF); cipher.Transcode(block.data(), block.size(), block.data(), Core::Crypto::Op::Decrypt); if (length + block_offset < 0x10) { std::memcpy(data, block.data() + block_offset, std::min(length, block.size())); -- cgit v1.2.3 From b1657b8c6b4ef07dd6eea92f4559a32ca3e0894a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 10 Dec 2020 01:31:58 -0500 Subject: vfs: Use existing type aliases consistently Makes use of the VirtualDir and VirtualFile aliases across the board instead of having a few isolated places that don't use it. --- src/core/file_sys/nca_patch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/file_sys/nca_patch.cpp') diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp index 5990a2fd5..adcf0732f 100644 --- a/src/core/file_sys/nca_patch.cpp +++ b/src/core/file_sys/nca_patch.cpp @@ -191,7 +191,7 @@ bool BKTR::Resize(std::size_t new_size) { return false; } -std::shared_ptr BKTR::GetContainingDirectory() const { +VirtualDir BKTR::GetContainingDirectory() const { return base_romfs->GetContainingDirectory(); } -- cgit v1.2.3 From 4f13e270c8c63f86a135426e381eef7d4837e5a4 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 5 Jan 2021 04:18:16 -0300 Subject: core: Silence warnings when compiling without asserts --- src/core/file_sys/nca_patch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/file_sys/nca_patch.cpp') diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp index adcf0732f..a65ec6798 100644 --- a/src/core/file_sys/nca_patch.cpp +++ b/src/core/file_sys/nca_patch.cpp @@ -51,8 +51,8 @@ std::pair SearchBucketEntry(u64 offset, const BlockTyp low = mid + 1; } } - UNREACHABLE_MSG("Offset could not be found in BKTR block."); + return {0, 0}; } } // Anonymous namespace -- cgit v1.2.3