mirror of https://github.com/OpenRCT2/OpenRCT2.git
Replace Memory::Move with std::copy
This commit is contained in:
parent
7851446a6f
commit
bb8b6a3f68
|
@ -102,17 +102,6 @@ namespace Memory
|
||||||
return (T*)memcpy((void*)dst, (const void*)src, size);
|
return (T*)memcpy((void*)dst, (const void*)src, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
static T * Move(T * dst, const T * src, size_t size)
|
|
||||||
{
|
|
||||||
if (size == 0) return (T*)dst;
|
|
||||||
Guard::ArgumentNotNull(dst, "Trying to move memory to nullptr");
|
|
||||||
Guard::ArgumentNotNull(src, "Trying to move memory from nullptr");
|
|
||||||
T* result =(T*)memmove((void*)dst, (const void*)src, size);
|
|
||||||
Guard::ArgumentNotNull(result, "Failed to move %u bytes of memory from %x to %x for %s", size, src, dst, typeid(T).name());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static T * Duplicate(const T * src, size_t size)
|
static T * Duplicate(const T * src, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -484,7 +484,7 @@ namespace String
|
||||||
Guard::Assert(newStringSize < currentStringSize, GUARD_LINE);
|
Guard::Assert(newStringSize < currentStringSize, GUARD_LINE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Memory::Move(str, firstNonWhitespace, newStringSize);
|
std::memmove(str, firstNonWhitespace, newStringSize);
|
||||||
str[newStringSize] = '\0';
|
str[newStringSize] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -925,7 +925,7 @@ static void vehicle_update_sound_params(rct_vehicle * vehicle)
|
||||||
// Shift all sound params down one if using a free space
|
// Shift all sound params down one if using a free space
|
||||||
if (soundParam != gVehicleSoundParamsListEnd)
|
if (soundParam != gVehicleSoundParamsListEnd)
|
||||||
{
|
{
|
||||||
Memory::Move<rct_vehicle_sound_params>(
|
std::memmove(
|
||||||
soundParam + 1,
|
soundParam + 1,
|
||||||
soundParam,
|
soundParam,
|
||||||
((gVehicleSoundParamsListEnd - soundParam) - 1) * sizeof(rct_vehicle_sound_params));
|
((gVehicleSoundParamsListEnd - soundParam) - 1) * sizeof(rct_vehicle_sound_params));
|
||||||
|
|
Loading…
Reference in New Issue