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

7zip: Use compression settings from file also for file header #1532

Merged
merged 2 commits into from
May 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion libarchive/archive_write_set_format_7zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,19 @@ _7z_close(struct archive_write *a)
*/
#if HAVE_LZMA_H
header_compression = _7Z_LZMA1;
if(zip->opt_compression == _7Z_LZMA2 ||
zip->opt_compression == _7Z_COPY)
header_compression = zip->opt_compression;

/* If the stored file is only one, do not encode the header.
* This is the same way 7z command does. */
if (zip->total_number_entry == 1)
header_compression = _7Z_COPY;
#else
header_compression = _7Z_COPY;
#endif
r = _7z_compression_init_encoder(a, header_compression, 6);
r = _7z_compression_init_encoder(a, header_compression,
zip->opt_compression_level);
if (r < 0)
return (r);
zip->crc32flg = PRECODE_CRC32;
Expand Down