]> wimlib.net Git - wimlib/blobdiff - src/xpress-compress.c
Refactor headers
[wimlib] / src / xpress-compress.c
index 21118e7652b2e17d2287c085cc7e571c4bf88c3c..6b28cca1741989db6c711b4b7916ccfde43b40d2 100644 (file)
  * along with wimlib; if not, see http://www.gnu.org/licenses/.
  */
 
-#include "xpress.h"
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "wimlib.h"
-#include "compress.h"
+#include "wimlib/assert.h"
+#include "wimlib/compress.h"
+#include "wimlib/util.h"
+#include "wimlib/xpress.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -239,23 +245,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;