[*] amend label pos

[*] always zero pointer fields in bytebuffer (early reset on uninitialized field -> crash)
[*] solve known deflate quirk
This commit is contained in:
Reece Wilson 2022-11-30 11:14:10 +00:00
parent 89d341b4fc
commit fe3db644bd
4 changed files with 18 additions and 14 deletions

View File

@ -61,11 +61,11 @@ namespace Aurora::Memory
AuUInt length;
/// Buffer pointer
AuUInt8 *base;
AuUInt8 *base {};
/// Stream pointer
AuUInt8 *readPtr;
AuUInt8 *readPtr {};
/// Stream pointer
AuUInt8 *writePtr;
AuUInt8 *writePtr {};
///////////////////////////////////////////////////////////////////////
// Stable ByteBuffer ABI Header; u32 flags //

View File

@ -122,14 +122,14 @@ namespace Aurora::Compression
return false;
}
if (!this->ctx_.avail_in)
while (this->ctx_.avail_in)
{
do
{
this->ctx_.avail_out = AuArraySize(this->dout_);
this->ctx_.next_out = this->dout_;
auto ret = deflate(&this->ctx_, type);
auto ret = deflate(&this->ctx_, Z_FULL_FLUSH);
if (ret < Z_OK)
{
SysPushErrorIO("Error: {}", zError(ret));
@ -139,19 +139,18 @@ namespace Aurora::Compression
auto have = AuArraySize(this->dout_) - this->ctx_.avail_out;
if (!Write(reinterpret_cast<const AuUInt8*>(this->dout_),
if (!Write(reinterpret_cast<const AuUInt8 *>(this->dout_),
have))
{
this->pReader_.reset();
SysPushErrorIO("Memory Error");
return false;
}
} while (this->ctx_.avail_out == 0);
return true;
}
while (this->ctx_.avail_out == 0);
}
while (this->ctx_.avail_in)
if (!this->ctx_.avail_in)
{
do
{
@ -175,8 +174,9 @@ namespace Aurora::Compression
SysPushErrorIO("Memory Error");
return false;
}
}
while (this->ctx_.avail_out == 0);
} while (this->ctx_.avail_out == 0);
return true;
}
return true;

View File

@ -291,6 +291,11 @@ namespace Aurora::Compression
inputStat += read;
flush = (!strm.avail_in || error == AuIO::EStreamError::eErrorEndOfStream) ? Z_FINISH : Z_NO_FLUSH;
if (read && read != AuArraySize(in))
{
flush = Z_FULL_FLUSH;
}
strm.next_in = in;
do

View File

@ -85,8 +85,6 @@ namespace Aurora::Debug
}
failFast:
try
{
Console::Pump();
@ -96,6 +94,7 @@ namespace Aurora::Debug
}
failFast:
static bool runPlatformFastFailOnce {};
if (!AuExchange(runPlatformFastFailOnce, true))