Zastąpienie makra zmienną globalną compression_level

This commit is contained in:
yanczi 2025-12-24 15:04:16 +01:00
parent 336e12d8c0
commit 109d10c3ca
2 changed files with 5 additions and 5 deletions

View file

@ -23,9 +23,6 @@ CompressionManager::CompressionManager()
:cctx(ZSTD_createCCtx()) :cctx(ZSTD_createCCtx())
,dctx(ZSTD_createDCtx()) ,dctx(ZSTD_createDCtx())
{ {
// Tu ustawienia pod kompresjê
const int level = COMPRESSION_LEVEL;
// Ustawienia frameless // Ustawienia frameless
size_t rc = 0; size_t rc = 0;
@ -42,7 +39,7 @@ CompressionManager::CompressionManager()
rc |= ZSTD_CCtx_setParameter(cctx, ZSTD_c_dictIDFlag, 0); rc |= ZSTD_CCtx_setParameter(cctx, ZSTD_c_dictIDFlag, 0);
// Ustawia poziom kompresji // Ustawia poziom kompresji
rc |= ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, level); rc |= ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, zstd::compression_level);
if (ZSTD_isError(rc)) { if (ZSTD_isError(rc)) {
std::cerr << "ZSTD_CCtx_setParameter error" << std::endl; std::cerr << "ZSTD_CCtx_setParameter error" << std::endl;

View file

@ -30,7 +30,10 @@
#error "Wymagane zstd >= 1.4.0 dla ZSTD_c_format / ZSTD_f_zstd1_magicless" #error "Wymagane zstd >= 1.4.0 dla ZSTD_c_format / ZSTD_f_zstd1_magicless"
#endif #endif
#define COMPRESSION_LEVEL 3 namespace zstd
{
inline constexpr short compression_level = 3;
}
class CompressionManager class CompressionManager
{ {