fix support for files >4gig (32bit vs 64bit size numbers)

This commit is contained in:
Green Sky 2023-08-22 17:17:41 +02:00
parent 15c627451d
commit 085d7bcff8
No known key found for this signature in database
5 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,7 @@ struct FileI {
virtual bool isGood(void) = 0; virtual bool isGood(void) = 0;
// TODO: move to owning/nonowning pointers // TODO: move to owning/nonowning pointers
virtual std::vector<uint8_t> read(uint64_t pos, uint32_t size) = 0; virtual std::vector<uint8_t> read(uint64_t pos, uint64_t size) = 0;
virtual bool write(uint64_t pos, const std::vector<uint8_t>& data) = 0; virtual bool write(uint64_t pos, const std::vector<uint8_t>& data) = 0;
}; };

View File

@ -29,7 +29,7 @@ struct FileRFile : public FileI {
return _file.is_open() && _file.good(); return _file.is_open() && _file.good();
} }
std::vector<uint8_t> read(uint64_t pos, uint32_t size) override { std::vector<uint8_t> read(uint64_t pos, uint64_t size) override {
if (_file_size > 0 && pos >= _file_size) { if (_file_size > 0 && pos >= _file_size) {
return {}; return {};
} }

View File

@ -15,7 +15,7 @@ struct FileRMem : public FileI {
return true; return true;
} }
std::vector<uint8_t> read(uint64_t pos, uint32_t size) override { std::vector<uint8_t> read(uint64_t pos, uint64_t size) override {
if (_file_size > 0 && pos >= _data.size()) { if (_file_size > 0 && pos >= _data.size()) {
return {}; return {};
} }

View File

@ -29,7 +29,7 @@ struct FileRWFile : public FileI {
return _file.is_open() && _file.good(); return _file.is_open() && _file.good();
} }
std::vector<uint8_t> read(uint64_t pos, uint32_t size) override { std::vector<uint8_t> read(uint64_t pos, uint64_t size) override {
if (pos >= _file_size) { if (pos >= _file_size) {
return {}; return {};
} }

View File

@ -23,7 +23,7 @@ struct FileWFile : public FileI {
} }
// write only // write only
std::vector<uint8_t> read(uint64_t, uint32_t) override { return {}; } std::vector<uint8_t> read(uint64_t, uint64_t) override { return {}; }
bool write(uint64_t pos, const std::vector<uint8_t>& data) override { bool write(uint64_t pos, const std::vector<uint8_t>& data) override {
if (_file_size > 0 && pos >= _file_size) { if (_file_size > 0 && pos >= _file_size) {