]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Reusing code from zip size known and adjusting comments
authorjiat75 <jiat0218@gmail.com>
Wed, 27 Oct 2021 12:28:20 +0000 (20:28 +0800)
committerjiat75 <jiat0218@gmail.com>
Wed, 27 Oct 2021 13:42:09 +0000 (21:42 +0800)
libarchive/archive_write_set_format_zip.c

index ea60054ce368ef536cf12fe871b1dab708926428..8c14a7027ebacc902e41686bde417544e976f7a8 100644 (file)
@@ -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) {