Merge pull request #5304 from lioncash/layered

layered_fs: Mark functions as static where applicable
This commit is contained in:
Pengfei Zhu 2020-05-02 08:02:35 +08:00 committed by GitHub
commit 5a008a74fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,7 +275,7 @@ void LayeredFS::LoadExtRelocations() {
} }
} }
std::size_t GetNameSize(const std::string& name) { static std::size_t GetNameSize(const std::string& name) {
std::u16string u16name = Common::UTF8ToUTF16(name); std::u16string u16name = Common::UTF8ToUTF16(name);
return Common::AlignUp(u16name.size() * 2, 4); return Common::AlignUp(u16name.size() * 2, 4);
} }
@ -310,7 +310,7 @@ void LayeredFS::PrepareBuild(Directory& current) {
} }
// Implementation from 3dbrew // Implementation from 3dbrew
u32 CalcHash(const std::string& name, u32 parent_offset) { static u32 CalcHash(const std::string& name, u32 parent_offset) {
u32 hash = parent_offset ^ 123456789; u32 hash = parent_offset ^ 123456789;
std::u16string u16name = Common::UTF8ToUTF16(name); std::u16string u16name = Common::UTF8ToUTF16(name);
for (char16_t c : u16name) { for (char16_t c : u16name) {
@ -320,7 +320,7 @@ u32 CalcHash(const std::string& name, u32 parent_offset) {
return hash; return hash;
} }
std::size_t WriteName(u8* dest, std::u16string name) { static std::size_t WriteName(u8* dest, std::u16string name) {
const auto buffer_size = Common::AlignUp(name.size() * 2, 4); const auto buffer_size = Common::AlignUp(name.size() * 2, 4);
std::vector<u16_le> buffer(buffer_size / 2); std::vector<u16_le> buffer(buffer_size / 2);
std::transform(name.begin(), name.end(), buffer.begin(), [](char16_t character) { std::transform(name.begin(), name.end(), buffer.begin(), [](char16_t character) {
@ -431,7 +431,7 @@ void LayeredFS::BuildFiles() {
} }
// Implementation from 3dbrew // Implementation from 3dbrew
std::size_t GetHashTableSize(std::size_t entry_count) { static std::size_t GetHashTableSize(std::size_t entry_count) {
if (entry_count < 3) { if (entry_count < 3) {
return 3; return 3;
} else if (entry_count < 19) { } else if (entry_count < 19) {