mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-15 02:49:42 -05:00
libarchive: Limit 7zip and zstd compression level to 6 on AIX
Extend commit 6287b02147 (libarchive: Limit xz compression level to 6 on
AIX, 2021-08-24, v3.22.0-rc1~188^2) to cover 7zip and zstd.
This commit is contained in:
@@ -265,6 +265,11 @@ archive_compressor_zstd_options(struct archive_write_filter *f, const char *key,
|
||||
if (level < minimum || level > maximum) {
|
||||
return (ARCHIVE_WARN);
|
||||
}
|
||||
#ifdef _AIX
|
||||
if (level > 6) {
|
||||
level = 6;
|
||||
}
|
||||
#endif
|
||||
data->compression_level = (int)level;
|
||||
return (ARCHIVE_OK);
|
||||
} else if (strcmp(key, "threads") == 0) {
|
||||
|
||||
@@ -511,6 +511,11 @@ _7z_options(struct archive_write *a, const char *key, const char *value)
|
||||
"compression-level option value `%ld' out of range", lvl);
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
#ifdef _AIX
|
||||
if (lvl > 6) {
|
||||
lvl = 6;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Note: we don't know here if this value is for zstd (negative to ~22),
|
||||
// or zlib-style 0-9. If zstd is enabled but not in use, we will need to
|
||||
|
||||
@@ -1365,6 +1365,11 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
|
||||
int zstd_compression_level = zip->compression_level == 1
|
||||
? ZSTD_minCLevel() // ZSTD_minCLevel is negative !
|
||||
: (zip->compression_level - 1) * ZSTD_maxCLevel() / 8;
|
||||
#ifdef _AIX
|
||||
if (zstd_compression_level > 6) {
|
||||
zstd_compression_level = 6;
|
||||
}
|
||||
#endif
|
||||
zip->stream.zstd.context = ZSTD_createCStream();
|
||||
size_t zret = ZSTD_initCStream(zip->stream.zstd.context, zstd_compression_level);
|
||||
if (ZSTD_isError(zret)) {
|
||||
|
||||
Reference in New Issue
Block a user