Address review comments pt. 2

This commit is contained in:
FearlessTobi
2024-02-19 19:22:51 +01:00
parent ba70dc4c13
commit ef50277124
6 changed files with 34 additions and 39 deletions

View File

@ -38,4 +38,29 @@ enum class CreateOption : u8 {
BigFile = (1 << 0),
};
struct FileSystemAttribute {
u8 dir_entry_name_length_max_defined;
u8 file_entry_name_length_max_defined;
u8 dir_path_name_length_max_defined;
u8 file_path_name_length_max_defined;
INSERT_PADDING_BYTES_NOINIT(0x5);
u8 utf16_dir_entry_name_length_max_defined;
u8 utf16_file_entry_name_length_max_defined;
u8 utf16_dir_path_name_length_max_defined;
u8 utf16_file_path_name_length_max_defined;
INSERT_PADDING_BYTES_NOINIT(0x18);
s32 dir_entry_name_length_max;
s32 file_entry_name_length_max;
s32 dir_path_name_length_max;
s32 file_path_name_length_max;
INSERT_PADDING_WORDS_NOINIT(0x5);
s32 utf16_dir_entry_name_length_max;
s32 utf16_file_entry_name_length_max;
s32 utf16_dir_path_name_length_max;
s32 utf16_file_path_name_length_max;
INSERT_PADDING_WORDS_NOINIT(0x18);
INSERT_PADDING_WORDS_NOINIT(0x1);
};
static_assert(sizeof(FileSystemAttribute) == 0xC0, "FileSystemAttribute has incorrect size");
} // namespace FileSys

View File

@ -91,12 +91,8 @@ public:
}
#define DECLARE_PATH_FLAG_HANDLER(__WHICH__) \
constexpr bool Is##__WHICH__##Allowed() const { \
return (m_value & __WHICH__##Flag) != 0; \
} \
constexpr void Allow##__WHICH__() { \
m_value |= __WHICH__##Flag; \
}
constexpr bool Is##__WHICH__##Allowed() const { return (m_value & __WHICH__##Flag) != 0; } \
constexpr void Allow##__WHICH__() { m_value |= __WHICH__##Flag; }
DECLARE_PATH_FLAG_HANDLER(WindowsPath)
DECLARE_PATH_FLAG_HANDLER(RelativePath)

View File

@ -56,7 +56,7 @@ private:
next_entry_index += actual_entries;
*out_count = actual_entries;
std::memcpy(out_entries, entries.data(), range_size);
std::memcpy(out_entries, begin, range_size);
R_SUCCEED();
}

View File

@ -125,10 +125,8 @@ protected:
private:
Result DoRead(size_t* out, s64 offset, void* buffer, size_t size, const ReadOption& option) {
std::vector<u8> output = backend->ReadBytes(size, offset);
*out = output.size();
std::memcpy(buffer, output.data(), size);
const auto read_size = backend->Read(static_cast<u8*>(buffer), size, offset);
*out = read_size;
R_SUCCEED();
}