task: Add header information to data

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2019-01-07 00:22:13 +01:00
parent 5facc71844
commit 808af66bb0
+5 -2
View File
@@ -18,9 +18,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "task.hpp"
#define SIZE_ELEMENT uint32_t
void datapath::windows::task::_assign(const std::vector<char>& data, std::shared_ptr<datapath::windows::overlapped> ov){
this->buffer.resize(data.size());
std::memcpy(buffer.data(), data.data(), data.size());
this->buffer.resize(data.size() + sizeof(SIZE_ELEMENT));
std::memcpy(buffer.data() + sizeof(SIZE_ELEMENT), data.data(), data.size());
reinterpret_cast<SIZE_ELEMENT&>(buffer[0]) = SIZE_ELEMENT(data.size());
this->overlapped = ov;
}