From: jiat75 Date: Wed, 27 Oct 2021 12:28:20 +0000 (+0800) Subject: Reusing code from zip size known and adjusting comments X-Git-Tag: v3.6.0~45^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02cfa8ae67fa60e6d0415b75babf64864f0d8e72;p=thirdparty%2Flibarchive.git Reusing code from zip size known and adjusting comments --- diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index ea60054ce..8c14a7027 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -740,17 +740,15 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) /* We may know the size, but never the CRC. */ zip->entry_flags |= ZIP_ENTRY_FLAG_LENGTH_AT_END; } else { - /* We don't know the size. In this case, we prefer - * deflate (it has a clear end-of-data marker which - * makes length-at-end more reliable) and will - * enable Zip64 extensions unless we're told not to. + /* We don't know the size. Use the default + * compression unless specified otherwise. + * We enable Zip64 extensions unless we're told not to. */ - #ifdef HAVE_ZLIB_H - if(zip->requested_compression == COMPRESSION_UNSPECIFIED){ - zip->entry_compression = COMPRESSION_DEFLATE; + zip->entry_compression = zip->requested_compression; + if(zip->entry_compression == COMPRESSION_UNSPECIFIED){ + zip->entry_compression = COMPRESSION_DEFAULT; } - #endif zip->entry_flags |= ZIP_ENTRY_FLAG_LENGTH_AT_END; if ((zip->flags & ZIP_FLAG_AVOID_ZIP64) == 0) {