Fixed incorrect packet buffer sizes

This commit is contained in:
Jordan Cristiano 2015-05-15 00:54:05 -04:00
parent 3752aecfa4
commit dc06efc1f3

View File

@ -118,6 +118,7 @@ void DemoReader::ProcessDem(void* inputFp, IDemoWriter* writer)
do do
{ {
size_t rawDataSize = 0;
reader.ReadCmdHeader(packet.cmd, packet.tick); reader.ReadCmdHeader(packet.cmd, packet.tick);
switch (packet.cmd) switch (packet.cmd)
{ {
@ -126,7 +127,7 @@ void DemoReader::ProcessDem(void* inputFp, IDemoWriter* writer)
reader.ReadCmdInfo(*packet.cmdInfo); reader.ReadCmdInfo(*packet.cmdInfo);
reader.ReadSequenceInfo(packet.sequenceInfo1, packet.sequenceInfo2); reader.ReadSequenceInfo(packet.sequenceInfo1, packet.sequenceInfo2);
assert(packet.sequenceInfo1 == packet.sequenceInfo2); assert(packet.sequenceInfo1 == packet.sequenceInfo2);
reader.ReadRawData(buffer.data(), buffer.size()); rawDataSize = reader.ReadRawData(buffer.data(), buffer.size());
break; break;
case dem_synctick: case dem_synctick:
// nothing // nothing
@ -157,7 +158,7 @@ void DemoReader::ProcessDem(void* inputFp, IDemoWriter* writer)
writer->StartCommandPacket(packet); writer->StartCommandPacket(packet);
if (packet.cmd == dem_packet || packet.cmd == dem_signon) if (packet.cmd == dem_packet || packet.cmd == dem_signon)
{ {
ParsePacket(buffer.data(), buffer.size(), context, writer); ParsePacket(buffer.data(), rawDataSize, context, writer);
} }
writer->EndCommandPacket(); writer->EndCommandPacket();
} while (packet.cmd != dem_stop); } while (packet.cmd != dem_stop);