From 2a94ebd67e2a341208c4849a92442ecd511fb716 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 8 Apr 2013 11:44:32 -0500 Subject: [PATCH] --disable-verify-compression by default --- archlinux/PKGBUILD | 4 ++-- configure.ac | 2 +- rpm/wimlib-minimal.spec | 1 - rpm/wimlib-without-ntfs-3g.spec | 3 +-- rpm/wimlib.spec | 3 +-- src/lzx-compress.c | 28 +++++++++++++++------------- src/xpress-compress.c | 30 ++++++++++++++++-------------- 7 files changed, 36 insertions(+), 35 deletions(-) diff --git a/archlinux/PKGBUILD b/archlinux/PKGBUILD index 358a163c..8fe0cfcd 100644 --- a/archlinux/PKGBUILD +++ b/archlinux/PKGBUILD @@ -18,8 +18,8 @@ source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz") build() { cd "$pkgname-$pkgver" - ./configure --disable-verify-compression --with-libcrypto --with-fuse \ - --with-ntfs-3g --enable-xattr --prefix=/usr + ./configure --with-libcrypto --with-fuse --with-ntfs-3g \ + --enable-xattr --prefix=/usr make } diff --git a/configure.ac b/configure.ac index 865ded24..4f755c60 100644 --- a/configure.ac +++ b/configure.ac @@ -150,7 +150,7 @@ AC_ARG_ENABLE([verify_compression], checking if blocks we compress can be correctly decompressed]), [ENABLE_VERIFY_COMPRESSION=$enableval], - [ENABLE_VERIFY_COMPRESSION=yes] + [ENABLE_VERIFY_COMPRESSION=no] ) AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION]) if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then diff --git a/rpm/wimlib-minimal.spec b/rpm/wimlib-minimal.spec index b1d44078..5d083c08 100644 --- a/rpm/wimlib-minimal.spec +++ b/rpm/wimlib-minimal.spec @@ -35,7 +35,6 @@ Development files for wimlib --without-ntfs-3g \ --without-fuse \ --disable-xattr \ - --disable-verify-compression \ --disable-multithreaded-compression \ --disable-custom-memory-allocator \ --disable-assertions diff --git a/rpm/wimlib-without-ntfs-3g.spec b/rpm/wimlib-without-ntfs-3g.spec index 337d7d1c..45ad0620 100644 --- a/rpm/wimlib-without-ntfs-3g.spec +++ b/rpm/wimlib-without-ntfs-3g.spec @@ -33,8 +33,7 @@ Development files for wimlib --disable-rpath \ --with-libcrypto \ --without-ntfs-3g \ - --enable-xattr \ - --disable-verify-compression + --enable-xattr %__make %{?_smp_mflags} %check diff --git a/rpm/wimlib.spec b/rpm/wimlib.spec index db2b7b4e..f1891fc2 100644 --- a/rpm/wimlib.spec +++ b/rpm/wimlib.spec @@ -35,8 +35,7 @@ Development files for wimlib --disable-rpath \ --with-libcrypto \ --with-ntfs-3g \ - --enable-xattr \ - --disable-verify-compression + --enable-xattr %__make %{?_smp_mflags} %check diff --git a/src/lzx-compress.c b/src/lzx-compress.c index 07fc9472..b23c2df0 100644 --- a/src/lzx-compress.c +++ b/src/lzx-compress.c @@ -747,21 +747,23 @@ wimlib_lzx_compress(const void *__uncompressed_data, unsigned uncompressed_len, #ifdef ENABLE_VERIFY_COMPRESSION /* Verify that we really get the same thing back when decompressing. */ - u8 buf[uncompressed_len]; - ret = wimlib_lzx_decompress(compressed_data, compressed_len, - buf, uncompressed_len); - if (ret != 0) { - ERROR("lzx_compress(): Failed to decompress data we compressed"); - abort(); - } - - for (i = 0; i < uncompressed_len; i++) { - if (buf[i] != *((u8*)__uncompressed_data + i)) { - ERROR("lzx_compress(): Data we compressed didn't " - "decompress to the original data (difference at " - "byte %u of %u)", i + 1, uncompressed_len); + { + u8 buf[uncompressed_len]; + ret = wimlib_lzx_decompress(compressed_data, compressed_len, + buf, uncompressed_len); + if (ret != 0) { + ERROR("lzx_compress(): Failed to decompress data we compressed"); abort(); } + + for (i = 0; i < uncompressed_len; i++) { + if (buf[i] != *((u8*)__uncompressed_data + i)) { + ERROR("lzx_compress(): Data we compressed didn't " + "decompress to the original data (difference at " + "byte %u of %u)", i + 1, uncompressed_len); + abort(); + } + } } #endif return compressed_len; diff --git a/src/xpress-compress.c b/src/xpress-compress.c index 21118e76..ec63eb18 100644 --- a/src/xpress-compress.c +++ b/src/xpress-compress.c @@ -239,23 +239,25 @@ wimlib_xpress_compress(const void *__uncompressed_data, wimlib_assert(compressed_len <= uncompressed_len - 1); -#ifdef ENABLE_VERIFY_COMPRESSION +#if defined(ENABLE_VERIFY_COMPRESSION) /* Verify that we really get the same thing back when decompressing. */ - u8 buf[uncompressed_len]; - ret = wimlib_xpress_decompress(__compressed_data, compressed_len, - buf, uncompressed_len); - if (ret) { - ERROR("xpress_compress(): Failed to decompress data we " - "compressed"); - abort(); - } - for (i = 0; i < uncompressed_len; i++) { - if (buf[i] != uncompressed_data[i]) { - ERROR("xpress_compress(): Data we compressed didn't " - "decompress to the original data (difference at " - "byte %u of %u)", i + 1, uncompressed_len); + { + u8 buf[uncompressed_len]; + ret = wimlib_xpress_decompress(__compressed_data, compressed_len, + buf, uncompressed_len); + if (ret) { + ERROR("xpress_compress(): Failed to decompress data we " + "compressed"); abort(); } + for (i = 0; i < uncompressed_len; i++) { + if (buf[i] != uncompressed_data[i]) { + ERROR("xpress_compress(): Data we compressed didn't " + "decompress to the original data (difference at " + "byte %u of %u)", i + 1, uncompressed_len); + abort(); + } + } } #endif return compressed_len; -- 2.43.0