fix support for files >4gig (32bit vs 64bit size numbers)
This commit is contained in:
parent
15c627451d
commit
085d7bcff8
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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 {};
|
||||||
}
|
}
|
||||||
|
@ -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 {};
|
||||||
}
|
}
|
||||||
|
@ -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 {};
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user