mirror of https://github.com/libAthena/athena.git
MemoryReader/MemoryWriter: Remove unnecessary reinterpret_casts
In most cases, these can be static casts or removed entirely.
This commit is contained in:
parent
1aa27c7289
commit
f5ad22ecf4
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue