citra-emu
/
citra
Archived
1
0
Fork 0

added std::vector<V> instead of V* (#5902)

This commit is contained in:
Carloschi7 2021-12-18 07:31:09 +01:00 committed by GitHub
parent 28039d39a1
commit 0126ecb3e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -5,6 +5,7 @@
#pragma once
#include <fstream>
#include <vector>
#include "common/common_types.h"
// defined in Version.cpp
@ -66,7 +67,7 @@ public:
// good header, read some key/value pairs
K key;
V* value = nullptr;
std::vector<V> value;
u32 value_size;
u32 entry_number;
@ -78,13 +79,13 @@ public:
if (next_extent > file_size)
break;
delete[] value;
value = new V[value_size];
value.clear();
value.resize(value_size);
// read key/value and pass to reader
if (Read(&key) && Read(value, value_size) && Read(&entry_number) &&
if (Read(&key) && Read(value.data(), value_size) && Read(&entry_number) &&
entry_number == m_num_entries + 1) {
reader.Read(key, value, value_size);
reader.Read(key, value.data(), value_size);
} else {
break;
}
@ -95,7 +96,7 @@ public:
m_file.seekp(last_pos);
m_file.clear();
delete[] value;
value.clear();
return m_num_entries;
}