1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 04:23:20 +01:00

Remove Memory::Duplicate and Memory::DuplicateArray (#7142)

This commit is contained in:
Ted John
2018-02-07 19:56:46 +00:00
committed by GitHub
parent 04ea015302
commit 142facb8a3
9 changed files with 44 additions and 79 deletions

View File

@@ -15,6 +15,7 @@
#pragma endregion
#include <algorithm>
#include <cstring>
#include "Math.hpp"
#include "Memory.hpp"
#include "MemoryStream.h"
@@ -27,7 +28,8 @@ MemoryStream::MemoryStream(const MemoryStream &copy)
if (_access & MEMORY_ACCESS::OWNER)
{
_data = Memory::Duplicate(copy._data, _dataCapacity);
_data = Memory::Allocate<void>(_dataCapacity);
std::memcpy(_data, copy._data, _dataCapacity);
_position = (void*)((uintptr_t)_data + copy.GetPosition());
}
}
@@ -71,7 +73,9 @@ const void * MemoryStream::GetData() const
void * MemoryStream::GetDataCopy() const
{
return Memory::Duplicate(_data, _dataSize);
auto result = Memory::Allocate<void>(_dataSize);
std::memcpy(result, _data, _dataSize);
return result;
}
void * MemoryStream::TakeData()