Match MxRAMStreamProvider::SetResourceToGet

This commit is contained in:
Christian Semmler 2023-12-29 18:33:30 -05:00
parent c890831c41
commit 562d6a966e
No known key found for this signature in database
GPG key ID: 086DAA1360BEEE5C

View file

@ -77,14 +77,14 @@ MxResult MxRAMStreamProvider::SetResourceToGet(MxStreamController* p_resource)
m_fileSize = m_pFile->CalcFileSize(); m_fileSize = m_pFile->CalcFileSize();
if (m_fileSize != 0) { if (m_fileSize != 0) {
m_bufferSize = m_pFile->GetBufferSize(); m_bufferSize = m_pFile->GetBufferSize();
m_pBufferOfFileSize = new MxU32[m_fileSize]; m_pBufferOfFileSize = (MxU32*) new MxU8[m_fileSize];
if (m_pBufferOfFileSize != NULL && if (m_pBufferOfFileSize != NULL &&
m_pFile->Read((unsigned char*) m_pBufferOfFileSize, m_fileSize) == SUCCESS) { m_pFile->Read((unsigned char*) m_pBufferOfFileSize, m_fileSize) == SUCCESS) {
m_lengthInDWords = m_pFile->GetLengthInDWords(); m_lengthInDWords = m_pFile->GetLengthInDWords();
m_bufferForDWords = new MxU32[m_lengthInDWords * sizeof(MxU32)]; m_bufferForDWords = new MxU32[m_lengthInDWords];
if (m_bufferForDWords != NULL) { if (m_bufferForDWords != NULL) {
memcpy(m_bufferForDWords, m_pFile->GetBuffer(), m_lengthInDWords); memcpy(m_bufferForDWords, m_pFile->GetBuffer(), m_lengthInDWords * sizeof(MxU32));
result = SUCCESS; result = SUCCESS;
} }
} }