[*] Refactor: added missing opt reference in member

This commit is contained in:
Reece Wilson 2023-07-28 08:10:08 +01:00
parent 2ce69049d9
commit 73548b00d7
4 changed files with 23 additions and 23 deletions

View File

@ -66,13 +66,13 @@ namespace Aurora::Compression
* Brotli: 16 <= x <= 24 * Brotli: 16 <= x <= 24
* recommended: * recommended:
*/ */
AuOptionalEx<AuUInt8> uWindowBits { }; AuOptionalEx<AuUInt8> uOptWindowBits { };
/** /**
* brotli: 0 <= x <= 11, * brotli: 0 <= x <= 11,
* zstd: 0 <= x <= 9, * zstd: 0 <= x <= 9,
*/ */
AuOptionalEx<AuUInt8> uQuality { 7 }; AuOptionalEx<AuUInt8> uOptQuality { 7 };
/** /**
* @brief Internal output buffer size. * @brief Internal output buffer size.
@ -115,7 +115,7 @@ namespace Aurora::Compression
/** /**
* @brief Flag for headerless decompression streams * @brief Flag for headerless decompression streams
*/ */
AuOptionalEx<AuInt8> uWindowBits { }; AuOptionalEx<AuInt8> uOptWindowBits { };
AuUInt8 uThreads { 1 }; AuUInt8 uThreads { 1 };

View File

@ -16,7 +16,7 @@ namespace Aurora::Compression
{ {
out = 0; out = 0;
if (!info.uWindowBits) if (!info.uOptWindowBits)
{ {
if (info.alg == ECompressionType::eGZip) if (info.alg == ECompressionType::eGZip)
{ {
@ -33,27 +33,27 @@ namespace Aurora::Compression
} }
} }
if (info.uWindowBits.value() < 0) if (info.uOptWindowBits.value() < 0)
{ {
return {}; return {};
} }
if (info.uWindowBits.value() > 15) if (info.uOptWindowBits.value() > 15)
{ {
return {}; return {};
} }
if (info.alg == ECompressionType::eGZip) if (info.alg == ECompressionType::eGZip)
{ {
out = info.uWindowBits.value() | 16; out = info.uOptWindowBits.value() | 16;
} }
else if (info.alg == ECompressionType::eDeflate) else if (info.alg == ECompressionType::eDeflate)
{ {
out = 0 - info.uWindowBits.value(); out = 0 - info.uOptWindowBits.value();
} }
else else
{ {
out = info.uWindowBits.value(); out = info.uOptWindowBits.value();
} }
return true; return true;
@ -64,7 +64,7 @@ namespace Aurora::Compression
{ {
out = 0; out = 0;
if (!info.uWindowBits) if (!info.uOptWindowBits)
{ {
if (info.type == ECompressionType::eGZip) if (info.type == ECompressionType::eGZip)
{ {
@ -83,15 +83,15 @@ namespace Aurora::Compression
if (info.type == ECompressionType::eGZip) if (info.type == ECompressionType::eGZip)
{ {
out = info.uWindowBits.value() | 16; out = info.uOptWindowBits.value() | 16;
} }
else if (info.type == ECompressionType::eDeflate) else if (info.type == ECompressionType::eDeflate)
{ {
out = 0 - info.uWindowBits.value(); out = 0 - info.uOptWindowBits.value();
} }
else else
{ {
out = info.uWindowBits.value(); out = info.uOptWindowBits.value();
} }
return true; return true;

View File

@ -58,12 +58,12 @@ namespace Aurora::Compression
} }
} }
if (meta.uQuality) if (meta.uOptQuality)
{ {
if (meta.uQuality.value() <= BROTLI_MAX_QUALITY && if (meta.uOptQuality.value() <= BROTLI_MAX_QUALITY &&
meta.uQuality.value() >= BROTLI_MIN_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"); SysPushErrorArg("Compressor couldn't set quality");
return false; return false;
@ -75,12 +75,12 @@ namespace Aurora::Compression
} }
} }
if (meta.uWindowBits) if (meta.uOptWindowBits)
{ {
if (meta.uWindowBits.value() <= BROTLI_MAX_INPUT_BLOCK_BITS && if (meta.uOptWindowBits.value() <= BROTLI_MAX_INPUT_BLOCK_BITS &&
meta.uWindowBits.value() >= BROTLI_MIN_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"); SysPushErrorArg("Compressor couldn't set window bits");
return false; return false;

View File

@ -58,9 +58,9 @@ namespace Aurora::Compression
return false; 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)) if (ZSTD_isError(uRet))
{ {
SysPushErrorArg("ZSTD_c_strategy"); SysPushErrorArg("ZSTD_c_strategy");