mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-27 06:22:49 +00:00
Fix build
Explicitly use `std::min<std::size_t>` Added virtual destructor
This commit is contained in:
parent
eed9de2336
commit
6e0afbaa19
|
@ -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;
|
const auto relative_offset = offset - current->first;
|
||||||
std::size_t to_read{};
|
std::size_t to_read{};
|
||||||
if (current->second->relocation.size > relative_offset) {
|
if (current->second->relocation.size > relative_offset) {
|
||||||
to_read =
|
to_read = std::min<std::size_t>(current->second->relocation.size - relative_offset,
|
||||||
std::min(current->second->relocation.size - relative_offset, length - read_size);
|
length - read_size);
|
||||||
}
|
}
|
||||||
const auto alignment =
|
const auto alignment =
|
||||||
std::min(Common::AlignUp(current->second->relocation.size, 16) - relative_offset,
|
std::min<std::size_t>(Common::AlignUp(current->second->relocation.size, 16) -
|
||||||
length - read_size) -
|
relative_offset,
|
||||||
|
length - read_size) -
|
||||||
to_read;
|
to_read;
|
||||||
|
|
||||||
// Read the file in different ways depending on relocation type
|
// Read the file in different ways depending on relocation type
|
||||||
|
|
|
@ -42,7 +42,7 @@ class LayeredFS : public RomFSReader {
|
||||||
public:
|
public:
|
||||||
explicit LayeredFS(std::shared_ptr<RomFSReader> romfs, std::string patch_path,
|
explicit LayeredFS(std::shared_ptr<RomFSReader> romfs, std::string patch_path,
|
||||||
std::string patch_ext_path);
|
std::string patch_ext_path);
|
||||||
~LayeredFS();
|
~LayeredFS() override;
|
||||||
|
|
||||||
std::size_t GetSize() const override;
|
std::size_t GetSize() const override;
|
||||||
std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) override;
|
std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) override;
|
||||||
|
|
|
@ -11,6 +11,8 @@ namespace FileSys {
|
||||||
*/
|
*/
|
||||||
class RomFSReader {
|
class RomFSReader {
|
||||||
public:
|
public:
|
||||||
|
virtual ~RomFSReader() = default;
|
||||||
|
|
||||||
virtual std::size_t GetSize() const = 0;
|
virtual std::size_t GetSize() const = 0;
|
||||||
virtual std::size_t ReadFile(std::size_t offset, std::size_t length, u8* buffer) = 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),
|
: is_encrypted(true), file(std::move(file)), key(key), ctr(ctr), file_offset(file_offset),
|
||||||
crypto_offset(crypto_offset), data_size(data_size) {}
|
crypto_offset(crypto_offset), data_size(data_size) {}
|
||||||
|
|
||||||
|
~DirectRomFSReader() override = default;
|
||||||
|
|
||||||
std::size_t GetSize() const override {
|
std::size_t GetSize() const override {
|
||||||
return data_size;
|
return data_size;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue