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:
@@ -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 ©)
|
||||
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user