]> wimlib.net Git - wimlib/blobdiff - src/compress.c
Use tchar for error file path
[wimlib] / src / compress.c
index 045a51042404c43f6010b5afec9d6683ff0a22fa..039836af5c8f19d62b954c5e79ea537762bca109 100644 (file)
@@ -38,8 +38,8 @@ struct wimlib_compressor {
 };
 
 static const struct compressor_ops *compressor_ops[] = {
-       [WIMLIB_COMPRESSION_TYPE_LZX]    = &lzx_compressor_ops,
        [WIMLIB_COMPRESSION_TYPE_XPRESS] = &xpress_compressor_ops,
+       [WIMLIB_COMPRESSION_TYPE_LZX]    = &lzx_compressor_ops,
        [WIMLIB_COMPRESSION_TYPE_LZMS]   = &lzms_compressor_ops,
 };
 
@@ -97,13 +97,12 @@ wimlib_get_compressor_needed_memory(enum wimlib_compression_type ctype,
 {
        const struct compressor_ops *ops;
        const struct wimlib_compressor_params_header *params;
+       u64 size;
 
        if (!compressor_ctype_valid(ctype))
                return 0;
 
        ops = compressor_ops[ctype];
-       if (ops->get_needed_memory == NULL)
-               return 0;
 
        if (extra_params) {
                params = extra_params;
@@ -113,8 +112,10 @@ wimlib_get_compressor_needed_memory(enum wimlib_compression_type ctype,
                params = compressor_default_params[ctype];
        }
 
-       return sizeof(struct wimlib_compressor) +
-               ops->get_needed_memory(max_block_size, params);
+       size = sizeof(struct wimlib_compressor);
+       if (ops->get_needed_memory)
+               size += ops->get_needed_memory(max_block_size, params);
+       return size;
 }