summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar Lioncash2020-04-15 15:59:23 -0400
committerGravatar Lioncash2020-04-15 21:33:46 -0400
commit1c340c6efad903580904297730d708ce8b947eb6 (patch)
treea79ad11775373ecf31912a7a50fcfbcc08d6e8b3 /src/core/file_sys
parentMerge pull request #3612 from ReinUsesLisp/red (diff)
downloadyuzu-1c340c6efad903580904297730d708ce8b947eb6.tar.gz
yuzu-1c340c6efad903580904297730d708ce8b947eb6.tar.xz
yuzu-1c340c6efad903580904297730d708ce8b947eb6.zip
CMakeLists: Specify -Wextra on linux builds
Allows reporting more cases where logic errors may exist, such as implicit fallthrough cases, etc. We currently ignore unused parameters, since we currently have many cases where this is intentional (virtual interfaces). While we're at it, we can also tidy up any existing code that causes warnings. This also uncovered a few bugs as well.
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/patch_manager.cpp3
-rw-r--r--src/core/file_sys/registered_cache.cpp23
-rw-r--r--src/core/file_sys/vfs_libzip.cpp4
3 files changed, 18 insertions, 12 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index e77e82b8d..81ec06cd4 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -440,7 +440,8 @@ std::map<std::string, std::string, std::less<>> PatchManager::GetPatchVersionNam
440 // Game Updates 440 // Game Updates
441 const auto update_tid = GetUpdateTitleID(title_id); 441 const auto update_tid = GetUpdateTitleID(title_id);
442 PatchManager update{update_tid}; 442 PatchManager update{update_tid};
443 auto [nacp, discard_icon_file] = update.GetControlMetadata(); 443 const auto metadata = update.GetControlMetadata();
444 const auto& nacp = metadata.first;
444 445
445 const auto update_disabled = 446 const auto update_disabled =
446 std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend(); 447 std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend();
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index 6e9cf67ef..ba5f76288 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -591,14 +591,18 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
591InstallResult RegisteredCache::InstallEntry(const NCA& nca, TitleType type, 591InstallResult RegisteredCache::InstallEntry(const NCA& nca, TitleType type,
592 bool overwrite_if_exists, const VfsCopyFunction& copy) { 592 bool overwrite_if_exists, const VfsCopyFunction& copy) {
593 CNMTHeader header{ 593 CNMTHeader header{
594 nca.GetTitleId(), ///< Title ID 594 nca.GetTitleId(), // Title ID
595 0, ///< Ignore/Default title version 595 0, // Ignore/Default title version
596 type, ///< Type 596 type, // Type
597 {}, ///< Padding 597 {}, // Padding
598 0x10, ///< Default table offset 598 0x10, // Default table offset
599 1, ///< 1 Content Entry 599 1, // 1 Content Entry
600 0, ///< No Meta Entries 600 0, // No Meta Entries
601 {}, ///< Padding 601 {}, // Padding
602 {}, // Reserved 1
603 0, // Is committed
604 0, // Required download system version
605 {}, // Reserved 2
602 }; 606 };
603 OptionalHeader opt_header{0, 0}; 607 OptionalHeader opt_header{0, 0};
604 ContentRecord c_rec{{}, {}, {}, GetCRTypeFromNCAType(nca.GetType()), {}}; 608 ContentRecord c_rec{{}, {}, {}, GetCRTypeFromNCAType(nca.GetType()), {}};
@@ -848,7 +852,8 @@ VirtualFile ManualContentProvider::GetEntryUnparsed(u64 title_id, ContentRecordT
848VirtualFile ManualContentProvider::GetEntryRaw(u64 title_id, ContentRecordType type) const { 852VirtualFile ManualContentProvider::GetEntryRaw(u64 title_id, ContentRecordType type) const {
849 const auto iter = 853 const auto iter =
850 std::find_if(entries.begin(), entries.end(), [title_id, type](const auto& entry) { 854 std::find_if(entries.begin(), entries.end(), [title_id, type](const auto& entry) {
851 const auto [title_type, content_type, e_title_id] = entry.first; 855 const auto content_type = std::get<1>(entry.first);
856 const auto e_title_id = std::get<2>(entry.first);
852 return content_type == type && e_title_id == title_id; 857 return content_type == type && e_title_id == title_id;
853 }); 858 });
854 if (iter == entries.end()) 859 if (iter == entries.end())
diff --git a/src/core/file_sys/vfs_libzip.cpp b/src/core/file_sys/vfs_libzip.cpp
index 11d1978ea..d69952940 100644
--- a/src/core/file_sys/vfs_libzip.cpp
+++ b/src/core/file_sys/vfs_libzip.cpp
@@ -42,11 +42,11 @@ VirtualDir ExtractZIP(VirtualFile file) {
42 continue; 42 continue;
43 43
44 if (name.back() != '/') { 44 if (name.back() != '/') {
45 std::unique_ptr<zip_file_t, decltype(&zip_fclose)> file{ 45 std::unique_ptr<zip_file_t, decltype(&zip_fclose)> file2{
46 zip_fopen_index(zip.get(), i, 0), zip_fclose}; 46 zip_fopen_index(zip.get(), i, 0), zip_fclose};
47 47
48 std::vector<u8> buf(stat.size); 48 std::vector<u8> buf(stat.size);
49 if (zip_fread(file.get(), buf.data(), buf.size()) != buf.size()) 49 if (zip_fread(file2.get(), buf.data(), buf.size()) != s64(buf.size()))
50 return nullptr; 50 return nullptr;
51 51
52 const auto parts = FileUtil::SplitPathComponents(stat.name); 52 const auto parts = FileUtil::SplitPathComponents(stat.name);