Skip to content

Commit

Permalink
Support compression levels >= 10 and use zstd's internal default level.
Browse files Browse the repository at this point in the history
zstd supports regular compression levels 1 through 22.  The special
level 0 indicates to use zstd's internal default (currently level 3).
  • Loading branch information
mkasick authored and nmoinvaz committed Sep 12, 2023
1 parent 680d6f1 commit 2160689
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion minizip.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ int main(int argc, const char *argv[]) {
else if ((c == 'v') || (c == 'V'))
options.verbose = 1;
else if ((c >= '0') && (c <= '9')) {
options.compress_level = (c - '0');
options.compress_level = (int16_t)atoi(&argv[i][1]);
if (options.compress_level == 0)
options.compress_method = MZ_COMPRESS_METHOD_STORE;
} else if ((c == 'b') || (c == 'B'))
Expand Down
2 changes: 1 addition & 1 deletion mz_strm_zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ int32_t mz_stream_zstd_set_prop_int64(void *stream, int32_t prop, int64_t value)
switch (prop) {
case MZ_STREAM_PROP_COMPRESS_LEVEL:
if (value < 0)
zstd->preset = 6;
zstd->preset = 0; // Use zstd default.
else
zstd->preset = (int16_t)value;
return MZ_OK;
Expand Down

0 comments on commit 2160689

Please sign in to comment.