diff options
author | Ferenc Arn <tagcup@yahoo.com> | 2017-06-11 20:27:07 -0500 |
---|---|---|
committer | Ferenc Arn <tagcup@yahoo.com> | 2017-06-11 20:27:07 -0500 |
commit | 98261e2df2820c1e2a424b043f448c18efee43c4 (patch) | |
tree | df7688fc9591d215fec4a3d0ae88b1578043c12f /core/io | |
parent | 12b2652ecbe4acfe1a0391b162629cb2a86c1a0b (diff) |
Expose zstd and zlib compression levels as global config.
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/compression.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/io/compression.cpp b/core/io/compression.cpp index 9c3e0e8eca..9ae54c38af 100644 --- a/core/io/compression.cpp +++ b/core/io/compression.cpp @@ -28,7 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "compression.h" - +#include "global_config.h" #include "os/copymem.h" #include "zip_io.h" @@ -37,8 +37,6 @@ #include <zlib.h> -#define ZSTD_DEFAULT_COMPRESSION 3 - int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode) { switch (p_mode) { @@ -60,7 +58,8 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, strm.zalloc = zipio_alloc; strm.zfree = zipio_free; strm.opaque = Z_NULL; - int err = deflateInit(&strm, Z_DEFAULT_COMPRESSION); + int level = GLOBAL_GET("compression/zlib_compression_level"); + int err = deflateInit(&strm, level); if (err != Z_OK) return -1; @@ -82,7 +81,8 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, case MODE_ZSTD: { int max_dst_size = get_max_compressed_buffer_size(p_src_size, MODE_ZSTD); - return ZSTD_compress(p_dst, max_dst_size, p_src, p_src_size, ZSTD_DEFAULT_COMPRESSION); + int level = GLOBAL_GET("compression/zstd_compression_level"); + return ZSTD_compress(p_dst, max_dst_size, p_src, p_src_size, level); } break; } |