diff options
author | shinyquagsire23 <mtinc2@gmail.com> | 2018-04-16 14:51:59 +0200 |
---|---|---|
committer | shinyquagsire23 <mtinc2@gmail.com> | 2018-04-16 14:51:59 +0200 |
commit | 83aa38b2390ac4af1757d03d3549d73e26dbfa10 (patch) | |
tree | eb7db95df6b9fcffa84b426845845e5a0814f2fd | |
parent | file_sys: Add HFS/PFS helper component (diff) | |
download | yuzu-83aa38b2390ac4af1757d03d3549d73e26dbfa10.tar yuzu-83aa38b2390ac4af1757d03d3549d73e26dbfa10.tar.gz yuzu-83aa38b2390ac4af1757d03d3549d73e26dbfa10.tar.bz2 yuzu-83aa38b2390ac4af1757d03d3549d73e26dbfa10.tar.lz yuzu-83aa38b2390ac4af1757d03d3549d73e26dbfa10.tar.xz yuzu-83aa38b2390ac4af1757d03d3549d73e26dbfa10.tar.zst yuzu-83aa38b2390ac4af1757d03d3549d73e26dbfa10.zip |
-rw-r--r-- | src/core/file_sys/partition_filesystem.cpp | 9 | ||||
-rw-r--r-- | src/core/file_sys/partition_filesystem.h | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/core/file_sys/partition_filesystem.cpp b/src/core/file_sys/partition_filesystem.cpp index f344e7970..12ba5f315 100644 --- a/src/core/file_sys/partition_filesystem.cpp +++ b/src/core/file_sys/partition_filesystem.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include <cinttypes> +#include <utility> #include "common/file_util.h" #include "common/logging/log.h" #include "core/file_sys/partition_filesystem.h" @@ -44,8 +45,8 @@ Loader::ResultStatus PartitionFilesystem::Load(const std::string& file_path, siz return result; } -Loader::ResultStatus PartitionFilesystem::Load(const std::vector<u8> file_data, size_t offset) { - size_t total_size = static_cast<size_t>(file_data.size() - offset); +Loader::ResultStatus PartitionFilesystem::Load(const std::vector<u8>& file_data, size_t offset) { + size_t total_size = file_data.size() - offset; if (total_size < sizeof(Header)) return Loader::ResultStatus::Error; @@ -61,7 +62,7 @@ Loader::ResultStatus PartitionFilesystem::Load(const std::vector<u8> file_data, memcpy(&entry.fs_entry, &file_data[entries_offset + (i * entry_size)], sizeof(FSEntry)); entry.name = std::string(reinterpret_cast<const char*>( &file_data[strtab_offset + entry.fs_entry.strtab_offset])); - pfs_entries.push_back(entry); + pfs_entries.push_back(std::move(entry)); } content_offset = strtab_offset + pfs_header.strtab_size; @@ -69,7 +70,7 @@ Loader::ResultStatus PartitionFilesystem::Load(const std::vector<u8> file_data, return Loader::ResultStatus::Success; } -u32 PartitionFilesystem::GetNumEntries(void) const { +u32 PartitionFilesystem::GetNumEntries() const { return pfs_header.num_entries; } diff --git a/src/core/file_sys/partition_filesystem.h b/src/core/file_sys/partition_filesystem.h index 4cc534f50..573c90057 100644 --- a/src/core/file_sys/partition_filesystem.h +++ b/src/core/file_sys/partition_filesystem.h @@ -24,9 +24,9 @@ namespace FileSys { class PartitionFilesystem { public: Loader::ResultStatus Load(const std::string& file_path, size_t offset = 0); - Loader::ResultStatus Load(const std::vector<u8> file_data, size_t offset = 0); + Loader::ResultStatus Load(const std::vector<u8>& file_data, size_t offset = 0); - u32 GetNumEntries(void) const; + u32 GetNumEntries() const; u64 GetEntryOffset(int index) const; u64 GetEntrySize(int index) const; std::string GetEntryName(int index) const; |