X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fxpress-compress.c;h=005a0a22452692d47372907255838ed61d8aa81d;hb=45d7e8a4f1740974e1dacd221676f9ec38c6b272;hp=518a0e3ba70b23fdd24a85df93a95c5da33f4f52;hpb=49a63aa13cdeb4c1348697ccd92207a1a65ec7b0;p=wimlib diff --git a/src/xpress-compress.c b/src/xpress-compress.c index 518a0e3b..005a0a22 100644 --- a/src/xpress-compress.c +++ b/src/xpress-compress.c @@ -39,7 +39,7 @@ #ifdef HAVE_ALLOCA_H # include #endif - +#include #include /* Intermediate XPRESS match/literal representation. */ @@ -99,7 +99,7 @@ xpress_write_matches_and_literals(struct output_bitstream *ostream, } struct xpress_record_ctx { - freq_t freqs[XPRESS_NUM_SYMBOLS]; + input_idx_t freqs[XPRESS_NUM_SYMBOLS]; struct xpress_match *matches; }; @@ -164,7 +164,6 @@ wimlib_xpress_compress(const void * restrict uncompressed_data, input_idx_t num_matches; input_idx_t compressed_len; input_idx_t i; - const size_t stack_max = 65536; /* XPRESS requires 256 bytes of overhead for the Huffman code, so it's * impossible to compress 256 bytes or less of data to less than the @@ -178,7 +177,7 @@ wimlib_xpress_compress(const void * restrict uncompressed_data, if (uncompressed_len < XPRESS_NUM_SYMBOLS / 2 + 1 + 4) return 0; - if (uncompressed_len <= stack_max) { + if (uncompressed_len <= STACK_MAX) { matches = alloca(uncompressed_len * sizeof(matches[0])); udata = alloca(uncompressed_len + 8); prev_tab = alloca(uncompressed_len * sizeof(prev_tab[0])); @@ -237,7 +236,7 @@ wimlib_xpress_compress(const void * restrict uncompressed_data, } compressed_len += XPRESS_NUM_SYMBOLS / 2; -#if defined(ENABLE_XPRESS_DEBUG) || defined(ENABLE_VERIFY_COMPRESSION) || 1 +#if defined(ENABLE_XPRESS_DEBUG) || defined(ENABLE_VERIFY_COMPRESSION) /* Verify that we really get the same thing back when decompressing. */ if (wimlib_xpress_decompress(compressed_data, compressed_len, udata, uncompressed_len)) @@ -259,7 +258,7 @@ wimlib_xpress_compress(const void * restrict uncompressed_data, #endif out_free: - if (uncompressed_len > stack_max) { + if (uncompressed_len > STACK_MAX) { FREE(matches); FREE(udata); FREE(prev_tab);