]> wimlib.net Git - wimlib/blobdiff - include/wimlib.h
Add wimlib_get_compressor_needed_memory()
[wimlib] / include / wimlib.h
index 372bb760af96f9ad73beb09b8e60a8bffca2f680..129a6c5a749a0e349b881fd0a5bd0ebe27b78870 100644 (file)
@@ -4118,6 +4118,8 @@ struct wimlib_decompressor;
  *
  * @retval ::WIMLIB_ERR_INVALID_COMPRESSION_TYPE
  *     @p ctype was not a supported compression type.
+ * @retval ::WIMLIB_ERR_INVALID_PARAM
+ *     @p params were invalid.
  * @retval ::WIMLIB_ERR_NOMEM
  *     Not enough memory to duplicate the parameters (perhaps @c params->size
  *     was invalid).
@@ -4126,6 +4128,18 @@ extern int
 wimlib_set_default_compressor_params(enum wimlib_compression_type ctype,
                                     const struct wimlib_compressor_params_header *params);
 
+/**
+ * Returns the approximate number of bytes needed to allocate a compressor with
+ * wimlib_create_compressor() for the specified compression type, block size,
+ * and parameters.  @p params may be @c NULL, in which case the current default
+ * parameters for @p ctype are used.  Returns 0 if the compression type or
+ * parameters are invalid.
+ */
+extern uint64_t
+wimlib_get_compressor_needed_memory(enum wimlib_compression_type ctype,
+                                   size_t max_block_size,
+                                   const struct wimlib_compressor_params_header *params);
+
 /**
  * Allocate a compressor for the specified compression type using the specified
  * parameters.