MemoryReader/MemoryWriter: Remove unnecessary reinterpret_casts

In most cases, these can be static casts or removed entirely.
This commit is contained in:
Lioncash 2020-04-18 03:46:24 -04:00
parent 1aa27c7289
commit f5ad22ecf4
2 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ MemoryReader::MemoryReader(const void* data, atUint64 length, bool takeOwnership
MemoryReader::~MemoryReader() { MemoryReader::~MemoryReader() {
if (m_owns) if (m_owns)
delete[] reinterpret_cast<const atUint8*>(m_data); delete[] static_cast<const atUint8*>(m_data);
} }
MemoryCopyReader::MemoryCopyReader(const void* data, atUint64 length) : MemoryReader(data, length, false) { 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); length = std::min(length, m_length - m_position);
memmove(buf, reinterpret_cast<const atUint8*>(m_data) + m_position, length); memmove(buf, static_cast<const atUint8*>(m_data) + m_position, length);
m_position += length; m_position += length;
return length; return length;
} }

View File

@ -233,7 +233,7 @@ void MemoryWriter::writeUBytes(const atUint8* data, atUint64 length) {
return; return;
} }
memmove(reinterpret_cast<atInt8*>(m_data + m_position), data, length); memmove(m_data + m_position, data, length);
m_position += length; m_position += length;
} }
@ -248,7 +248,7 @@ void MemoryCopyWriter::writeUBytes(const atUint8* data, atUint64 length) {
if (m_position + length > m_length) if (m_position + length > m_length)
resize(m_position + length); resize(m_position + length);
memmove(reinterpret_cast<atInt8*>(m_data + m_position), data, length); memmove(m_data + m_position, data, length);
m_position += length; m_position += length;
} }