[*] ByteBuffer::WriteFromEx flagExpandable awareness

[*] ByteBuffer::WriteFrom updates flagWriteError on failure
This commit is contained in:
Reece Wilson 2023-01-09 07:02:06 +00:00
parent fbca5f22c5
commit 3d763e58b4

View File

@ -18,6 +18,12 @@ namespace Aurora::Memory
do
{
auto readView = buffer.GetNextLinearRead();
if (this->flagExpandable && !this->CanWrite(readView.length))
{
this->Resize((this->writePtr - this->base) + readView.length);
}
auto writeView = this->GetNextLinearWrite();
auto uReadNext = AuMin(readView.length, writeView.length);
@ -46,6 +52,8 @@ namespace Aurora::Memory
bool ByteBuffer::WriteFrom(ByteBuffer &buffer)
{
auto readable = buffer.RemainingBytes();
return this->WriteFromEx(buffer, readable) == readable;
bool bStatus = this->WriteFromEx(buffer, readable) == readable;
this->flagWriteError |= !bStatus;
return bStatus;
}
}