This commit is contained in:
Reece Wilson 2023-04-19 03:53:52 +01:00
parent 99123bb094
commit 11ba608727

View File

@ -14,13 +14,13 @@ namespace Aurora::Compression
{
AUKN_SYM bool Compress(const AuMemoryViewRead &source, AuByteBuffer &out, int iCompressionLevel /* -7 to 22 */)
{
if (!out.GetOrAllocateLinearWriteable(source.length))
if (!out.GetOrAllocateLinearWriteable(AuMax<AuUInt>(source.length, 20u)))
{
SysPushErrorMemory();
return {};
}
auto uRet = ::ZSTD_compress(out.writePtr, source.length, source.ptr, source.length, iCompressionLevel);
auto uRet = ::ZSTD_compress(out.writePtr, out.length, source.ptr, source.length, iCompressionLevel);
if (::ZSTD_isError(uRet))
{
return false;