[*] Unify/make consistent one compression out of memory space to write into error as code 0x69, string="OOM"

This commit is contained in:
Reece Wilson 2024-05-30 01:15:37 +01:00
parent c3e898d53d
commit a1c1e88f51
11 changed files with 23 additions and 22 deletions

View File

@ -108,7 +108,7 @@ namespace Aurora::Compression
have)) have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
} }
@ -158,7 +158,7 @@ namespace Aurora::Compression
have)) have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return false; return false;
} }
@ -188,7 +188,7 @@ namespace Aurora::Compression
have)) have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return false; return false;
} }

View File

@ -108,7 +108,7 @@ namespace Aurora::Compression
if (!Write2(pMainDOut, if (!Write2(pMainDOut,
have)) have))
{ {
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
this->pReader_.reset(); this->pReader_.reset();
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }

View File

@ -162,7 +162,7 @@ namespace Aurora::Compression
if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut), have)) if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut), have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
} }
@ -216,7 +216,7 @@ namespace Aurora::Compression
if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut), have)) if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut), have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return false; return false;
} }
} }

View File

@ -99,7 +99,7 @@ namespace Aurora::Compression
if (!Write2(pMainDOut, have)) if (!Write2(pMainDOut, have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
} }

View File

@ -96,7 +96,7 @@ namespace Aurora::Compression
have)) have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
@ -145,7 +145,7 @@ namespace Aurora::Compression
if (!Write2(reinterpret_cast<const AuUInt8 *>(this->dout_), have)) if (!Write2(reinterpret_cast<const AuUInt8 *>(this->dout_), have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return false; return false;
} }
} }
@ -173,7 +173,7 @@ namespace Aurora::Compression
if (!Write2(pMainDOut, have)) if (!Write2(pMainDOut, have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return false; return false;
} }
} while (this->ctx_.avail_out == 0); } while (this->ctx_.avail_out == 0);

View File

@ -90,7 +90,7 @@ namespace Aurora::Compression
auto ret = inflate(&this->ctx_, Z_NO_FLUSH); auto ret = inflate(&this->ctx_, Z_NO_FLUSH);
if (ret < Z_OK) if (ret < Z_OK)
{ {
SysPushErrorIO("Error: {}", zError(ret)); this->SetLastError((int)ret, zError(ret));
this->pReader_.reset(); this->pReader_.reset();
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
@ -102,7 +102,7 @@ namespace Aurora::Compression
have)) have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }

View File

@ -106,7 +106,7 @@ namespace Aurora::Compression
{ {
if (!Write(this->pBufferOut_.get(), frameS2Ptr)) if (!Write(this->pBufferOut_.get(), frameS2Ptr))
{ {
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return {}; return {};
} }
} }

View File

@ -85,6 +85,7 @@ namespace Aurora::Compression
if (ret != LZMA_OK) if (ret != LZMA_OK)
{ {
this->SetLastError((int)ret);
SysPushErrorGeneric("LZMA Coder failure: {}", (int)ret); SysPushErrorGeneric("LZMA Coder failure: {}", (int)ret);
AuResetMember(this->pReader_); AuResetMember(this->pReader_);
return false; return false;
@ -145,7 +146,7 @@ namespace Aurora::Compression
have)) have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
@ -185,7 +186,7 @@ namespace Aurora::Compression
if (ret != LZMA_OK && if (ret != LZMA_OK &&
ret != LZMA_STREAM_END) ret != LZMA_STREAM_END)
{ {
SysPushErrorIO("Error: {}", int(ret)); this->SetLastError(int(ret));
this->pReader_.reset(); this->pReader_.reset();
return false; return false;
} }
@ -195,7 +196,7 @@ namespace Aurora::Compression
if (!Write2(reinterpret_cast<const AuUInt8 *>(this->dout_), have)) if (!Write2(reinterpret_cast<const AuUInt8 *>(this->dout_), have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return false; return false;
} }
} }
@ -214,7 +215,7 @@ namespace Aurora::Compression
if (ret != LZMA_OK && if (ret != LZMA_OK &&
ret != LZMA_STREAM_END) ret != LZMA_STREAM_END)
{ {
SysPushErrorIO("Error: {}", int(ret)); this->SetLastError(int(ret));
this->pReader_.reset(); this->pReader_.reset();
return false; return false;
} }
@ -224,7 +225,7 @@ namespace Aurora::Compression
if (!Write2(pMainDOut, have)) if (!Write2(pMainDOut, have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return false; return false;
} }
} }

View File

@ -128,10 +128,10 @@ namespace Aurora::Compression
done += have; done += have;
if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut), if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut),
have)) have))
{ {
this->pReader_.reset(); this->pReader_.reset();
SysPushErrorIO("Compression Out of Overhead"); this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }

View File

@ -163,8 +163,8 @@ namespace Aurora::Compression
if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut), if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut),
AuUInt32(output.pos))) AuUInt32(output.pos)))
{ {
SysPushErrorIO("Compression Out of Overhead");
this->pReader_.reset(); this->pReader_.reset();
this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
} }

View File

@ -101,8 +101,8 @@ namespace Aurora::Compression
if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut), if (!Write2(reinterpret_cast<const AuUInt8 *>(pMainDOut),
AuUInt32(output.pos))) AuUInt32(output.pos)))
{ {
SysPushErrorIO("Compression Out of Overhead");
this->pReader_.reset(); this->pReader_.reset();
this->SetLastError(0x69, "OOM");
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
} }