mirror of
https://github.com/zlib-ng/minizip-ng
synced 2026-08-25 14:26:08 -04:00
Match default compression level value in compress streams #726
This commit is contained in:
parent
1e9c6d8361
commit
97d8e65dc8
4 changed files with 7 additions and 4 deletions
|
|
@ -326,7 +326,7 @@ int32_t mz_stream_bzip_set_prop_int64(void *stream, int32_t prop, int64_t value)
|
|||
mz_stream_bzip *bzip = (mz_stream_bzip *)stream;
|
||||
switch (prop) {
|
||||
case MZ_STREAM_PROP_COMPRESS_LEVEL:
|
||||
if (value < 0)
|
||||
if (value == MZ_COMPRESS_LEVEL_DEFAULT)
|
||||
bzip->level = 6;
|
||||
else
|
||||
bzip->level = (int16_t)value;
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ int32_t mz_stream_lzma_set_prop_int64(void *stream, int32_t prop, int64_t value)
|
|||
mz_stream_lzma *lzma = (mz_stream_lzma *)stream;
|
||||
switch (prop) {
|
||||
case MZ_STREAM_PROP_COMPRESS_LEVEL:
|
||||
if (value < 0 || value > 9)
|
||||
if (value == MZ_COMPRESS_LEVEL_DEFAULT)
|
||||
lzma->preset = LZMA_PRESET_DEFAULT;
|
||||
else
|
||||
lzma->preset = (uint32_t)value;
|
||||
|
|
|
|||
|
|
@ -347,7 +347,10 @@ int32_t mz_stream_zlib_set_prop_int64(void *stream, int32_t prop, int64_t value)
|
|||
mz_stream_zlib *zlib = (mz_stream_zlib *)stream;
|
||||
switch (prop) {
|
||||
case MZ_STREAM_PROP_COMPRESS_LEVEL:
|
||||
zlib->level = (int16_t)value;
|
||||
if (value == MZ_COMPRESS_LEVEL_DEFAULT)
|
||||
zlib->level = Z_DEFAULT_COMPRESSION;
|
||||
else
|
||||
zlib->level = (int16_t)value;
|
||||
break;
|
||||
case MZ_STREAM_PROP_TOTAL_IN_MAX:
|
||||
zlib->max_total_in = value;
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ int32_t mz_stream_zstd_set_prop_int64(void *stream, int32_t prop, int64_t value)
|
|||
mz_stream_zstd *zstd = (mz_stream_zstd *)stream;
|
||||
switch (prop) {
|
||||
case MZ_STREAM_PROP_COMPRESS_LEVEL:
|
||||
if (value < 0)
|
||||
if (value == MZ_COMPRESS_LEVEL_DEFAULT)
|
||||
zstd->preset = ZSTD_CLEVEL_DEFAULT;
|
||||
else
|
||||
zstd->preset = (int16_t)value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue