Fix build
Explicitly use `std::min<std::size_t>` Added virtual destructor
This commit is contained in:
parent
eed9de2336
commit
6e0afbaa19
3 changed files with 10 additions and 5 deletions
|
@ -515,12 +515,13 @@ std::size_t LayeredFS::ReadFile(std::size_t offset, std::size_t length, u8* buff
|
|||
const auto relative_offset = offset - current->first;
|
||||
std::size_t to_read{};
|
||||
if (current->second->relocation.size > relative_offset) {
|
||||
to_read =
|
||||
std::min(current->second->relocation.size - relative_offset, length - read_size);
|
||||
to_read = std::min<std::size_t>(current->second->relocation.size - relative_offset,
|
||||
length - read_size);
|
||||
}
|
||||
const auto alignment =
|
||||
std::min(Common::AlignUp(current->second->relocation.size, 16) - relative_offset,
|
||||
length - read_size) -
|
||||
std::min<std::size_t>(Common::AlignUp(current->second->relocation.size, 16) -
|
||||
relative_offset,
|
||||
length - read_size) -
|
||||
to_read;
|
||||
|
||||
// Read the file in different ways depending on relocation type
|
||||
|
|
|
@ -42,7 +42,7 @@ class LayeredFS : public RomFSReader {
|
|||
public:
|
||||
explicit LayeredFS(std::shared_ptr<RomFSReader> romfs, std::string patch_path,
|
||||
std::string patch_ext_path);
|
||||
~LayeredFS();
|
||||
~LayeredFS() override;
|
||||
|
||||
std::size_t GetSize() const override;
|
||||
std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) override;
|
||||
|
|
|
@ -11,6 +11,8 @@ namespace FileSys {
|
|||
*/
|
||||
class RomFSReader {
|
||||
public:
|
||||
virtual ~RomFSReader() = default;
|
||||
|
||||
virtual std::size_t GetSize() const = 0;
|
||||
virtual std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) = 0;
|
||||
};
|
||||
|
@ -30,6 +32,8 @@ public:
|
|||
: is_encrypted(true), file(std::move(file)), key(key), ctr(ctr), file_offset(file_offset),
|
||||
crypto_offset(crypto_offset), data_size(data_size) {}
|
||||
|
||||
~DirectRomFSReader() override = default;
|
||||
|
||||
std::size_t GetSize() const override {
|
||||
return data_size;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue