From 57ad780321c798f29dfd375e8fc46b7e9de385ec Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 6 Sep 2019 03:25:40 -0400 Subject: [PATCH] MemoryWriter: Remove unnecessary type cast within MemoryWriter constructor and setData() The input type is already the same type as the class member, so the cast is unnecessary. While we're at it, we can also remove an unnecessary initializer for m_position, since we initialize this to zero within the class declaration already. --- src/athena/MemoryWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/athena/MemoryWriter.cpp b/src/athena/MemoryWriter.cpp index 256cbf9..a7e3c68 100644 --- a/src/athena/MemoryWriter.cpp +++ b/src/athena/MemoryWriter.cpp @@ -10,7 +10,7 @@ namespace athena::io { MemoryWriter::MemoryWriter(atUint8* data, atUint64 length, bool takeOwnership) -: m_data((atUint8*)data), m_length(length), m_position(0), m_bufferOwned(takeOwnership) { +: m_data(data), m_length(length), m_bufferOwned(takeOwnership) { if (!data) { atError(fmt("data cannot be NULL")); setError(); @@ -156,7 +156,7 @@ void MemoryWriter::setData(atUint8* data, atUint64 length, bool takeOwnership) { if (m_bufferOwned) delete m_data; - m_data = (atUint8*)data; + m_data = data; m_length = length; m_position = 0; m_bufferOwned = takeOwnership;