]> wimlib.net Git - wimlib/blobdiff - src/lzms_compress.c
header cleanups
[wimlib] / src / lzms_compress.c
index 8ba9bcbc1cfa9bd9ef97e1381d25eaad4dc8c47f..411d667ffefdfb95ee6271725a2ddb92a0227c29 100644 (file)
 #  include "config.h"
 #endif
 
+#include <limits.h>
+#include <pthread.h>
+#include <string.h>
+
 #include "wimlib/compress_common.h"
 #include "wimlib/compressor_ops.h"
 #include "wimlib/endianness.h"
 #include "wimlib/unaligned.h"
 #include "wimlib/util.h"
 
-#include <string.h>
-#include <limits.h>
-#include <pthread.h>
-
 /* Stucture used for writing raw bits as a series of 16-bit little endian coding
  * units.  This starts at the *end* of the compressed data buffer and proceeds
  * backwards.  */
@@ -1422,9 +1422,7 @@ lzms_build_mf_params(const struct lzms_compressor_params *lzms_params,
        memset(mf_params, 0, sizeof(*mf_params));
 
        /* Choose an appropriate match-finding algorithm.  */
-       if (max_window_size <= 2097152)
-               mf_params->algorithm = LZ_MF_BINARY_TREES;
-       else if (max_window_size <= 33554432)
+       if (max_window_size <= 33554432)
                mf_params->algorithm = LZ_MF_LCP_INTERVAL_TREE;
        else
                mf_params->algorithm = LZ_MF_LINKED_SUFFIX_ARRAY;
@@ -1445,7 +1443,7 @@ lzms_get_needed_memory(size_t max_block_size, unsigned int compression_level)
        struct lz_mf_params mf_params;
        u64 size = 0;
 
-       if (max_block_size >= INT32_MAX)
+       if (max_block_size > LZMS_MAX_BUFFER_SIZE)
                return 0;
 
        lzms_build_params(compression_level, &params);
@@ -1478,7 +1476,7 @@ lzms_create_compressor(size_t max_block_size, unsigned int compression_level,
        struct lzms_compressor_params params;
        struct lz_mf_params mf_params;
 
-       if (max_block_size >= INT32_MAX)
+       if (max_block_size > LZMS_MAX_BUFFER_SIZE)
                return WIMLIB_ERR_INVALID_PARAM;
 
        lzms_build_params(compression_level, &params);