2020-04-29 18:02:36 +02:00
|
|
|
#include "PluginData.h"
|
2022-05-14 14:00:20 +02:00
|
|
|
#include "utils/logger.h"
|
|
|
|
#include "utils/utils.h"
|
|
|
|
|
2023-08-16 10:18:02 +02:00
|
|
|
PluginData::PluginData(const std::vector<uint8_t> &input, std::string source) : length(input.size()), mSource(std::move(source)) {
|
2022-05-14 14:00:20 +02:00
|
|
|
auto data_copy = make_unique_nothrow<uint8_t[]>(length);
|
|
|
|
if (!data_copy) {
|
|
|
|
DEBUG_FUNCTION_LINE_ERR("Failed to allocate space on default heap");
|
|
|
|
this->length = 0;
|
|
|
|
} else {
|
|
|
|
DEBUG_FUNCTION_LINE_VERBOSE("Allocated %d kb on default heap", length / 1024);
|
|
|
|
memcpy(data_copy.get(), &input[0], length);
|
|
|
|
this->buffer = std::move(data_copy);
|
2020-04-29 18:02:36 +02:00
|
|
|
}
|
|
|
|
}
|