Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow negative zstd compression level #726

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions mz_strm_zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef struct mz_stream_zstd_s {
int64_t max_total_in;
int64_t max_total_out;
int8_t initialized;
uint32_t preset;
int32_t preset;
} mz_stream_zstd;

/***************************************************************************/
Expand Down Expand Up @@ -312,10 +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)
zstd->preset = 6;
else
zstd->preset = (int16_t)value;
zstd->preset = (int32_t)value;
return MZ_OK;
case MZ_STREAM_PROP_TOTAL_IN_MAX:
zstd->max_total_in = value;
Expand All @@ -329,6 +326,7 @@ void *mz_stream_zstd_create(void) {
if (zstd) {
zstd->stream.vtbl = &mz_stream_zstd_vtbl;
zstd->max_total_out = -1;
zstd->preset = ZSTD_CLEVEL_DEFAULT;
}
return zstd;
}
Expand Down