From f5ad22ecf4445a2b90e9fe0ece149c2ddd438b05 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 18 Apr 2020 03:46:24 -0400 Subject: [PATCH] MemoryReader/MemoryWriter: Remove unnecessary reinterpret_casts In most cases, these can be static casts or removed entirely. --- src/athena/MemoryReader.cpp | 4 ++-- src/athena/MemoryWriter.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/athena/MemoryReader.cpp b/src/athena/MemoryReader.cpp index 9b60938..bdbd3df 100644 --- a/src/athena/MemoryReader.cpp +++ b/src/athena/MemoryReader.cpp @@ -21,7 +21,7 @@ MemoryReader::MemoryReader(const void* data, atUint64 length, bool takeOwnership MemoryReader::~MemoryReader() { if (m_owns) - delete[] reinterpret_cast(m_data); + delete[] static_cast(m_data); } MemoryCopyReader::MemoryCopyReader(const void* data, atUint64 length) : MemoryReader(data, length, false) { @@ -111,7 +111,7 @@ atUint64 MemoryReader::readUBytesToBuf(void* buf, atUint64 length) { } length = std::min(length, m_length - m_position); - memmove(buf, reinterpret_cast(m_data) + m_position, length); + memmove(buf, static_cast(m_data) + m_position, length); m_position += length; return length; } diff --git a/src/athena/MemoryWriter.cpp b/src/athena/MemoryWriter.cpp index a0be0e2..a825fd6 100644 --- a/src/athena/MemoryWriter.cpp +++ b/src/athena/MemoryWriter.cpp @@ -233,7 +233,7 @@ void MemoryWriter::writeUBytes(const atUint8* data, atUint64 length) { return; } - memmove(reinterpret_cast(m_data + m_position), data, length); + memmove(m_data + m_position, data, length); m_position += length; } @@ -248,7 +248,7 @@ void MemoryCopyWriter::writeUBytes(const atUint8* data, atUint64 length) { if (m_position + length > m_length) resize(m_position + length); - memmove(reinterpret_cast(m_data + m_position), data, length); + memmove(m_data + m_position, data, length); m_position += length; }