mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 09:25:31 +02:00
Make memory storage mutable
This commit is contained in:
parent
b40e4d4e85
commit
c6b72dfe3c
2 changed files with 5 additions and 2 deletions
|
@ -33,7 +33,9 @@ FileStoragePointer Storage::toFileStorage(const QString& filename) const {
|
|||
|
||||
MemoryStorage::MemoryStorage(size_t size, const uint8_t* data) {
|
||||
_data.resize(size);
|
||||
memcpy(_data.data(), data, size);
|
||||
if (data) {
|
||||
memcpy(_data.data(), data, size);
|
||||
}
|
||||
}
|
||||
|
||||
FileStoragePointer FileStorage::create(const QString& filename, size_t size, const uint8_t* data) {
|
||||
|
|
|
@ -43,8 +43,9 @@ namespace storage {
|
|||
|
||||
class MemoryStorage : public Storage {
|
||||
public:
|
||||
MemoryStorage(size_t size, const uint8_t* data);
|
||||
MemoryStorage(size_t size, const uint8_t* data = nullptr);
|
||||
const uint8_t* data() const override { return _data.data(); }
|
||||
uint8_t* data() { return _data.data(); }
|
||||
size_t size() const override { return _data.size(); }
|
||||
private:
|
||||
std::vector<uint8_t> _data;
|
||||
|
|
Loading…
Reference in a new issue