From: Harry Mallon Date: Wed, 11 Mar 2020 12:14:36 +0000 (+0000) Subject: zstd: Fix support for compression-level>=20 when using binary X-Git-Tag: v3.4.3~23^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f64804954c84265454463e923d276fc968dcd047;p=thirdparty%2Flibarchive.git zstd: Fix support for compression-level>=20 when using binary * Requires '--ultra' argument --- diff --git a/libarchive/archive_write_add_filter_zstd.c b/libarchive/archive_write_add_filter_zstd.c index 280a20f67..e02d1c1cb 100644 --- a/libarchive/archive_write_add_filter_zstd.c +++ b/libarchive/archive_write_add_filter_zstd.c @@ -59,6 +59,8 @@ struct private_data { #endif }; +#define CLEVEL_STD_MAX 19 /* without using --ultra */ + static int archive_compressor_zstd_options(struct archive_write_filter *, const char *, const char *); static int archive_compressor_zstd_open(struct archive_write_filter *); @@ -300,6 +302,10 @@ archive_compressor_zstd_open(struct archive_write_filter *f) /* --no-check matches library default */ archive_string_sprintf(&as, "zstd -%d --no-check", data->compression_level); + if (data->compression_level > CLEVEL_STD_MAX) { + archive_strcat(&as, " --ultra"); + } + f->write = archive_compressor_zstd_write; r = __archive_write_program_open(f, data->pdata, as.s); archive_string_free(&as);