From 9285ed562c208959e0d5034e0ab4289cc40a31a2 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 11 Apr 2015 08:55:27 -0500 Subject: [PATCH] Remove --enable-verify-compression option It is easy to do manual verification with 'wimverify', and this was already broken since "destructive" compression was introduced. --- NEWS | 3 +++ configure.ac | 12 ---------- src/compress.c | 63 +++----------------------------------------------- 3 files changed, 6 insertions(+), 72 deletions(-) diff --git a/NEWS b/NEWS index be31de5a..7b4a0e37 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ Version 1.8.1-BETA: than 4 gigabytes are now never extracted as externally backed. This works around a bug in Microsoft's "WOF" driver. + The '--enable-verify-compression' configure option has been removed. If + you want to verify a WIM file, use the 'wimverify' program. + Version 1.8.0: Improved the LZX compressor. It is now 15-20% faster than before and provides a slightly better compression ratio. diff --git a/configure.ac b/configure.ac index 8c804b86..0ac6c99b 100644 --- a/configure.ac +++ b/configure.ac @@ -272,18 +272,6 @@ if test "$ENABLE_ASSERTIONS" = "yes"; then AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions]) fi -AC_MSG_CHECKING([whether to include automatic compression verification]) -AC_ARG_ENABLE([verify_compression], - AS_HELP_STRING([--enable-verify-compression], - [verify all compression results (makes compression - slower; intended for debugging only)]), - [ENABLE_VERIFY_COMPRESSION=$enableval], - [ENABLE_VERIFY_COMPRESSION=no]) -AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION]) -if test "$ENABLE_VERIFY_COMPRESSION" = "yes"; then - AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify compression results]) -fi - AC_MSG_CHECKING([whether to include support for multi-threaded compression]) AC_ARG_ENABLE([multithreaded-compression], AS_HELP_STRING([--disable-multithreaded-compression], diff --git a/src/compress.c b/src/compress.c index ff28ebc0..259e7a4c 100644 --- a/src/compress.c +++ b/src/compress.c @@ -26,9 +26,6 @@ # include "config.h" #endif -#include -#include - #include "wimlib.h" #include "wimlib/error.h" #include "wimlib/compressor_ops.h" @@ -174,66 +171,12 @@ wimlib_compress(const void *uncompressed_data, size_t uncompressed_size, void *compressed_data, size_t compressed_size_avail, struct wimlib_compressor *c) { - size_t compressed_size; - if (unlikely(uncompressed_size == 0 || uncompressed_size > c->max_block_size)) return 0; - compressed_size = c->ops->compress(uncompressed_data, - uncompressed_size, - compressed_data, - compressed_size_avail, - c->private); - - /* (Optional) Verify that we really get the same thing back when - * decompressing. Should always be the case, unless there's a bug. */ -#ifdef ENABLE_VERIFY_COMPRESSION - if (compressed_size != 0) { - struct wimlib_decompressor *d; - int res; - u8 *buf; - - buf = MALLOC(uncompressed_size); - if (!buf) { - WARNING("Unable to verify results of %s compression " - "(can't allocate buffer)", - wimlib_get_compression_type_string(c->ctype)); - return 0; - } - - res = wimlib_create_decompressor(c->ctype, - c->max_block_size, &d); - if (res) { - WARNING("Unable to verify results of %s compression " - "(can't create decompressor)", - wimlib_get_compression_type_string(c->ctype)); - FREE(buf); - return 0; - } - - res = wimlib_decompress(compressed_data, compressed_size, - buf, uncompressed_size, d); - wimlib_free_decompressor(d); - if (res) { - ERROR("Failed to decompress our %s-compressed data", - wimlib_get_compression_type_string(c->ctype)); - FREE(buf); - abort(); - } - - res = memcmp(uncompressed_data, buf, uncompressed_size); - FREE(buf); - - if (res) { - ERROR("Our %s-compressed data did not decompress " - "to original", - wimlib_get_compression_type_string(c->ctype)); - abort(); - } - } -#endif /* ENABLE_VERIFY_COMPRESSION */ - - return compressed_size; + return c->ops->compress(uncompressed_data, uncompressed_size, + compressed_data, compressed_size_avail, + c->private); } WIMLIBAPI void -- 2.43.0