Remove --enable-verify-compression option
authorEric Biggers <ebiggers3@gmail.com>
Sat, 11 Apr 2015 13:55:27 +0000 (08:55 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 11 Apr 2015 14:02:05 +0000 (09:02 -0500)
It is easy to do manual verification with 'wimverify', and this was
already broken since "destructive" compression was introduced.

NEWS
configure.ac
src/compress.c

diff --git a/NEWS b/NEWS
index be31de5a4ab78df93847b81e4d24f17c15d50302..7b4a0e37ee11b7bf7e78f83197a998f4354e2c89 100644 (file)
--- 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.
 
        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.
 Version 1.8.0:
        Improved the LZX compressor.  It is now 15-20% faster than before and
        provides a slightly better compression ratio.
index 8c804b869cbdcab4b1d7e8adfafa0ccdfa8b7037..0ac6c99b852613a32c40dc469366465786bc9966 100644 (file)
@@ -272,18 +272,6 @@ if test "$ENABLE_ASSERTIONS" = "yes"; then
        AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions])
 fi
 
        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],
 AC_MSG_CHECKING([whether to include support for multi-threaded compression])
 AC_ARG_ENABLE([multithreaded-compression],
        AS_HELP_STRING([--disable-multithreaded-compression],
index ff28ebc0f79d915701a9fdb0ef68ac47e3fbda8c..259e7a4caca38aa3434d7f4ac3742346428144a0 100644 (file)
@@ -26,9 +26,6 @@
 #  include "config.h"
 #endif
 
 #  include "config.h"
 #endif
 
-#include <stdlib.h>
-#include <string.h>
-
 #include "wimlib.h"
 #include "wimlib/error.h"
 #include "wimlib/compressor_ops.h"
 #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)
 {
                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;
 
        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
 }
 
 WIMLIBAPI void