Don't recompress when the same compression method as in the original is requested.
diff --git a/lib/zip_set_file_compression.c b/lib/zip_set_file_compression.c index 5402392..9af99cd 100644 --- a/lib/zip_set_file_compression.c +++ b/lib/zip_set_file_compression.c
@@ -60,7 +60,11 @@ e = za->entry+idx; - if (method == ZIP_CM_DEFAULT && e->orig == NULL) { + zip_int32_t old_method = (e->orig == NULL ? ZIP_CM_DEFAULT : e->orig->comp_method); + + /* XXX: revisit this when flags are supported, since they may require a recompression */ + + if (method == old_method) { if (e->changes) { e->changes->changed &= ~ZIP_DIRENT_COMP_METHOD; if (e->changes->changed == 0) {