Fix: Improve data parsing
This commit updates the data parsing logic within the XAudioPacketAligned class. Specifically, it uses `ParseInt32` and `ParseInt8` instead of direct data stream reading, improving type safety and ensuring correct data handling during parsing.
This commit is contained in:
parent
1f7ca563bf
commit
3d378b28c9
@ -8,7 +8,7 @@ XAudioPacketAligned::XAudioPacketAligned()
|
|||||||
, aXmaLoop()
|
, aXmaLoop()
|
||||||
, mContext()
|
, mContext()
|
||||||
{
|
{
|
||||||
|
SetName("Audio Packet Aligned");
|
||||||
}
|
}
|
||||||
|
|
||||||
XAudioPacketAligned::~XAudioPacketAligned()
|
XAudioPacketAligned::~XAudioPacketAligned()
|
||||||
@ -16,14 +16,11 @@ XAudioPacketAligned::~XAudioPacketAligned()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XAudioPacketAligned::ParseData(QDataStream *aStream)
|
void XAudioPacketAligned::ParseData(XDataStream *aStream)
|
||||||
{
|
{
|
||||||
qint32 bufferPtr, contextPtr;
|
qint32 bufferPtr = aStream->ParseInt32(QString("%1 buffer ptr").arg(GetName()));
|
||||||
|
mBufferSize = aStream->ParseUInt32(QString("%1 buffer size").arg(GetName()));
|
||||||
*aStream
|
mLoopCount = aStream->ParseUInt32(QString("%1 loop count").arg(GetName()));
|
||||||
>> bufferPtr
|
|
||||||
>> mBufferSize
|
|
||||||
>> mLoopCount;
|
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
@ -31,15 +28,16 @@ void XAudioPacketAligned::ParseData(QDataStream *aStream)
|
|||||||
loop.ParseData(aStream);
|
loop.ParseData(aStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aStream >> contextPtr;
|
qint32 contextPtr = aStream->ParseInt32(QString("%1 context ptr").arg(GetName()));
|
||||||
|
|
||||||
if (bufferPtr)
|
if (bufferPtr)
|
||||||
{
|
{
|
||||||
aStream->readRawData(mBuffer.data(), mBufferSize);
|
aStream->readRawData(mBuffer.data(), mBufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contextPtr)
|
if (contextPtr)
|
||||||
{
|
{
|
||||||
*aStream >> mContext;
|
mContext = aStream->ParseInt8(QString("%1 context").arg(GetName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user