[*] Update AuByteBuffer::Pad to include bUpdateWriteHead argument. broke previous behavior bc this is more convenient and old users were already doing this after the fact

This commit is contained in:
Reece Wilson 2024-07-09 02:08:17 +01:00
parent ac69c4c2ff
commit daf4552eb2
2 changed files with 10 additions and 3 deletions

View File

@ -397,7 +397,7 @@ namespace Aurora::Memory
// Utilities // Utilities
inline bool Trim(AuUInt tail); inline bool Trim(AuUInt tail);
inline bool Pad(AuUInt16 aPowOf2, AuUInt8 magicCharacter = '\x00'); inline bool Pad(AuUInt16 aPowOf2, AuUInt8 magicCharacter = '\x00', bool bUpdateWriteHead = true);
inline bool Fill(AuUInt length, AuUInt8 magicCharacter = '\x00'); inline bool Fill(AuUInt length, AuUInt8 magicCharacter = '\x00');
// Templated read/write for **PODs** // Templated read/write for **PODs**

View File

@ -67,7 +67,7 @@ namespace Aurora::Memory
return true; return true;
} }
bool ByteBuffer::Pad(AuUInt16 aPowOf2, AuUInt8 magicCharacter) bool ByteBuffer::Pad(AuUInt16 aPowOf2, AuUInt8 magicCharacter, bool bUpdateWriteHead)
{ {
ByteBufferPushWriteState a(*this); ByteBufferPushWriteState a(*this);
@ -85,7 +85,14 @@ namespace Aurora::Memory
return false; return false;
} }
this->writePtr = this->base + length; if (bUpdateWriteHead)
{
this->writePtr = this->base + newLen;
}
else
{
this->writePtr = this->base + length;
}
return true; return true;
} }
} }