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()
|
||||
, mContext()
|
||||
{
|
||||
|
||||
SetName("Audio Packet Aligned");
|
||||
}
|
||||
|
||||
XAudioPacketAligned::~XAudioPacketAligned()
|
||||
@ -16,14 +16,11 @@ XAudioPacketAligned::~XAudioPacketAligned()
|
||||
|
||||
}
|
||||
|
||||
void XAudioPacketAligned::ParseData(QDataStream *aStream)
|
||||
void XAudioPacketAligned::ParseData(XDataStream *aStream)
|
||||
{
|
||||
qint32 bufferPtr, contextPtr;
|
||||
|
||||
*aStream
|
||||
>> bufferPtr
|
||||
>> mBufferSize
|
||||
>> mLoopCount;
|
||||
qint32 bufferPtr = aStream->ParseInt32(QString("%1 buffer ptr").arg(GetName()));
|
||||
mBufferSize = aStream->ParseUInt32(QString("%1 buffer size").arg(GetName()));
|
||||
mLoopCount = aStream->ParseUInt32(QString("%1 loop count").arg(GetName()));
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
@ -31,15 +28,16 @@ void XAudioPacketAligned::ParseData(QDataStream *aStream)
|
||||
loop.ParseData(aStream);
|
||||
}
|
||||
|
||||
*aStream >> contextPtr;
|
||||
qint32 contextPtr = aStream->ParseInt32(QString("%1 context ptr").arg(GetName()));
|
||||
|
||||
if (bufferPtr)
|
||||
{
|
||||
aStream->readRawData(mBuffer.data(), mBufferSize);
|
||||
}
|
||||
|
||||
if (contextPtr)
|
||||
{
|
||||
*aStream >> mContext;
|
||||
mContext = aStream->ParseInt8(QString("%1 context").arg(GetName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user