[*] Refactor: added missing opt reference in member
This commit is contained in:
parent
2ce69049d9
commit
73548b00d7
@ -66,13 +66,13 @@ namespace Aurora::Compression
|
||||
* Brotli: 16 <= x <= 24
|
||||
* recommended:
|
||||
*/
|
||||
AuOptionalEx<AuUInt8> uWindowBits { };
|
||||
AuOptionalEx<AuUInt8> uOptWindowBits { };
|
||||
|
||||
/**
|
||||
* brotli: 0 <= x <= 11,
|
||||
* zstd: 0 <= x <= 9,
|
||||
*/
|
||||
AuOptionalEx<AuUInt8> uQuality { 7 };
|
||||
AuOptionalEx<AuUInt8> uOptQuality { 7 };
|
||||
|
||||
/**
|
||||
* @brief Internal output buffer size.
|
||||
@ -115,7 +115,7 @@ namespace Aurora::Compression
|
||||
/**
|
||||
* @brief Flag for headerless decompression streams
|
||||
*/
|
||||
AuOptionalEx<AuInt8> uWindowBits { };
|
||||
AuOptionalEx<AuInt8> uOptWindowBits { };
|
||||
|
||||
AuUInt8 uThreads { 1 };
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace Aurora::Compression
|
||||
{
|
||||
out = 0;
|
||||
|
||||
if (!info.uWindowBits)
|
||||
if (!info.uOptWindowBits)
|
||||
{
|
||||
if (info.alg == ECompressionType::eGZip)
|
||||
{
|
||||
@ -33,27 +33,27 @@ namespace Aurora::Compression
|
||||
}
|
||||
}
|
||||
|
||||
if (info.uWindowBits.value() < 0)
|
||||
if (info.uOptWindowBits.value() < 0)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
if (info.uWindowBits.value() > 15)
|
||||
if (info.uOptWindowBits.value() > 15)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
if (info.alg == ECompressionType::eGZip)
|
||||
{
|
||||
out = info.uWindowBits.value() | 16;
|
||||
out = info.uOptWindowBits.value() | 16;
|
||||
}
|
||||
else if (info.alg == ECompressionType::eDeflate)
|
||||
{
|
||||
out = 0 - info.uWindowBits.value();
|
||||
out = 0 - info.uOptWindowBits.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
out = info.uWindowBits.value();
|
||||
out = info.uOptWindowBits.value();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -64,7 +64,7 @@ namespace Aurora::Compression
|
||||
{
|
||||
out = 0;
|
||||
|
||||
if (!info.uWindowBits)
|
||||
if (!info.uOptWindowBits)
|
||||
{
|
||||
if (info.type == ECompressionType::eGZip)
|
||||
{
|
||||
@ -83,15 +83,15 @@ namespace Aurora::Compression
|
||||
|
||||
if (info.type == ECompressionType::eGZip)
|
||||
{
|
||||
out = info.uWindowBits.value() | 16;
|
||||
out = info.uOptWindowBits.value() | 16;
|
||||
}
|
||||
else if (info.type == ECompressionType::eDeflate)
|
||||
{
|
||||
out = 0 - info.uWindowBits.value();
|
||||
out = 0 - info.uOptWindowBits.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
out = info.uWindowBits.value();
|
||||
out = info.uOptWindowBits.value();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -58,12 +58,12 @@ namespace Aurora::Compression
|
||||
}
|
||||
}
|
||||
|
||||
if (meta.uQuality)
|
||||
if (meta.uOptQuality)
|
||||
{
|
||||
if (meta.uQuality.value() <= BROTLI_MAX_QUALITY &&
|
||||
meta.uQuality.value() >= BROTLI_MIN_QUALITY)
|
||||
if (meta.uOptQuality.value() <= BROTLI_MAX_QUALITY &&
|
||||
meta.uOptQuality.value() >= BROTLI_MIN_QUALITY)
|
||||
{
|
||||
if (!BrotliEncoderSetParameter(this->pState, BrotliEncoderParameter::BROTLI_PARAM_QUALITY, meta.uQuality.value()))
|
||||
if (!BrotliEncoderSetParameter(this->pState, BrotliEncoderParameter::BROTLI_PARAM_QUALITY, meta.uOptQuality.value()))
|
||||
{
|
||||
SysPushErrorArg("Compressor couldn't set quality");
|
||||
return false;
|
||||
@ -75,12 +75,12 @@ namespace Aurora::Compression
|
||||
}
|
||||
}
|
||||
|
||||
if (meta.uWindowBits)
|
||||
if (meta.uOptWindowBits)
|
||||
{
|
||||
if (meta.uWindowBits.value() <= BROTLI_MAX_INPUT_BLOCK_BITS &&
|
||||
meta.uWindowBits.value() >= BROTLI_MIN_INPUT_BLOCK_BITS)
|
||||
if (meta.uOptWindowBits.value() <= BROTLI_MAX_INPUT_BLOCK_BITS &&
|
||||
meta.uOptWindowBits.value() >= BROTLI_MIN_INPUT_BLOCK_BITS)
|
||||
{
|
||||
if (!BrotliEncoderSetParameter(this->pState, BrotliEncoderParameter::BROTLI_PARAM_LGWIN, meta.uWindowBits))
|
||||
if (!BrotliEncoderSetParameter(this->pState, BrotliEncoderParameter::BROTLI_PARAM_LGWIN, meta.uOptWindowBits))
|
||||
{
|
||||
SysPushErrorArg("Compressor couldn't set window bits");
|
||||
return false;
|
||||
|
@ -58,9 +58,9 @@ namespace Aurora::Compression
|
||||
return false;
|
||||
}
|
||||
|
||||
if (meta.uQuality)
|
||||
if (meta.uOptQuality)
|
||||
{
|
||||
uRet = ZSTD_CCtx_setParameter(this->cctx_, ZSTD_c_strategy, meta.uQuality.value());
|
||||
uRet = ZSTD_CCtx_setParameter(this->cctx_, ZSTD_c_strategy, meta.uOptQuality.value());
|
||||
if (ZSTD_isError(uRet))
|
||||
{
|
||||
SysPushErrorArg("ZSTD_c_strategy");
|
||||
|
Loading…
Reference in New Issue
Block a user