Use reference on MxDSObject Deserialize calls (#767)

This commit is contained in:
MS
2024-04-03 12:06:53 -04:00
committed by GitHub
parent 56827fb2c4
commit ce134e79ef
17 changed files with 74 additions and 65 deletions

View File

@@ -322,7 +322,7 @@ MxCore* MxDSBuffer::ReadChunk(MxDSBuffer* p_buffer, MxU32* p_chunkData, MxU16 p_
switch (*p_chunkData) {
case FOURCC('M', 'x', 'O', 'b'):
result = DeserializeDSObjectDispatch(&dataStart, p_flags);
result = DeserializeDSObjectDispatch(dataStart, p_flags);
break;
case FOURCC('M', 'x', 'C', 'h'):
result = new MxStreamChunk();

View File

@@ -113,7 +113,7 @@ MxU32 ReadData(MxU8* p_buffer, MxU32 p_size)
data2 = data;
data += 8;
MxDSObject* obj = DeserializeDSObjectDispatch(&data, -1);
MxDSObject* obj = DeserializeDSObjectDispatch(data, -1);
id = obj->GetObjectId();
delete obj;

View File

@@ -36,12 +36,19 @@ MxU32 MxStreamChunk::ReadChunkHeader(MxU8* p_chunkData)
MxU32 headersize = 0;
if (p_chunkData) {
MxU8* chunkData = p_chunkData;
// Note: the alpha debug version uses memcpy calls here,
// but the code generation is the same.
GetScalar(&p_chunkData, m_flags);
GetScalar(&p_chunkData, m_objectId);
GetScalar(&p_chunkData, m_time);
GetScalar(&p_chunkData, m_length);
memcpy(&m_flags, p_chunkData, sizeof(m_flags));
p_chunkData += sizeof(m_flags);
memcpy(&m_objectId, p_chunkData, sizeof(m_objectId));
p_chunkData += sizeof(m_objectId);
memcpy(&m_time, p_chunkData, sizeof(m_time));
p_chunkData += sizeof(m_time);
memcpy(&m_length, p_chunkData, sizeof(m_length));
p_chunkData += sizeof(m_length);
m_data = p_chunkData;
headersize = p_chunkData - chunkData;
}