*
* XPRESS compression routines.
*
+ * See the comments in xpress-decomp.c about the XPRESS format.
+ */
+
+/*
* Copyright (C) 2012 Eric Biggers
*
- * wimlib - Library for working with WIM files
+ * This file is part of wimlib, a library for working with WIM files.
*
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option) any
- * later version.
+ * wimlib is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
*
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
*
- * You should have received a copy of the GNU Lesser General Public License along
- * with this library; if not, write to the Free Software Foundation, Inc., 59
- * Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with wimlib; if not, see http://www.gnu.org/licenses/.
*/
-/* See the comments in xpress-decomp.c about the XPRESS format. */
-
-
#include "xpress.h"
#include "comp.h"
#include <stdlib.h>
uint i;
int ret;
- XPRESS_DEBUG("uncompressed_len = %u\n", uncompressed_len);
+ XPRESS_DEBUG("uncompressed_len = %u", uncompressed_len);
if (uncompressed_len < 300)
return 1;
NULL, freq_tab,
&xpress_lz_params);
- XPRESS_DEBUG("using %u matches\n", num_matches);
+ XPRESS_DEBUG("using %u matches", num_matches);
freq_tab[256]++;
compressed_len = ostream.output - (u8*)__compressed_data;
- XPRESS_DEBUG("Compressed %u => %u bytes\n",
- uncompressed_len, compressed_len);
+ XPRESS_DEBUG("Compressed %u => %u bytes",
+ uncompressed_len, compressed_len);
*compressed_len_ret = compressed_len;
#ifdef ENABLE_VERIFY_COMPRESSION
/* Verify that we really get the same thing back when decompressing. */
- XPRESS_DEBUG("Verifying the compressed data.\n");
+ XPRESS_DEBUG("Verifying the compressed data.");
u8 buf[uncompressed_len];
ret = xpress_decompress(__compressed_data, compressed_len, buf,
uncompressed_len);
if (ret != 0) {
- fprintf(stderr, "xpress_compress(): Failed to decompress data "
- "we compressed!\n");
+ ERROR("xpress_compress(): Failed to decompress data we "
+ "compressed");
abort();
}
for (i = 0; i < uncompressed_len; i++) {
if (buf[i] != uncompressed_data[i]) {
- fprintf(stderr, "xpress_compress(): Data we compressed "
- "didn't decompress to the original data "
- "(difference at byte %u of %u)\n",
- i + 1, uncompressed_len);
+ ERROR("xpress_compress(): Data we compressed didn't "
+ "decompress to the original data (difference at "
+ "byte %u of %u)", i + 1, uncompressed_len);
abort();
}
}
- XPRESS_DEBUG("Compression verified to be correct.\n");
+ XPRESS_DEBUG("Compression verified to be correct.");
#endif
return 0;