Remove the elfio reader from the PluginData class, use it when it's needed

This commit is contained in:
Maschell
2020-06-03 18:34:31 +02:00
parent 1917ff9fb4
commit 2b517b5699
8 changed files with 46 additions and 97 deletions

View File

@@ -33,45 +33,28 @@ enum eMemoryTypes {
class PluginData {
public:
const std::optional<elfio *> &getReader() const {
return reader;
}
~PluginData() {
if (nReader != NULL) {
delete nReader;
nReader = NULL;
}
}
void freeMemory();
void *getBuffer() const {
return this->buffer;
}
PluginData(const PluginData &obj);
PluginData() {
}
void *buffer;
void *buffer = NULL;
MEMHeapHandle heapHandle;
eMemoryTypes memoryType;
size_t length;
size_t length = 0;
private:
PluginData(std::vector<uint8_t> buffer);
PluginData(std::vector<uint8_t> input, MEMHeapHandle heapHandle, eMemoryTypes memoryType);
void loadReader();
static std::optional<PluginData> createFromExistingData(const void *buffer, MEMHeapHandle heapHandle, eMemoryTypes memoryType, const size_t length);
std::optional<elfio *> reader;
elfio *nReader = NULL;
friend class PluginDataFactory;