From: Eric Biggers Date: Sat, 14 Jun 2014 04:31:33 +0000 (-0500) Subject: compress.c: Always include base compressor size X-Git-Tag: v1.7.0~21 X-Git-Url: https://wimlib.net/git/?a=commitdiff_plain;h=a4458395b4e8227b7f125ab99cea6a0a6d87ee8f;p=wimlib compress.c: Always include base compressor size When the struct compressor_ops does not provide get_needed_memory(), still include the size of the struct wimlib_compressor. --- diff --git a/src/compress.c b/src/compress.c index 84044077..039836af 100644 --- a/src/compress.c +++ b/src/compress.c @@ -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; }