XZ Utils
5.4.0
|
Filter-specific stuff common for both encoder and decoder. More...
#include "filter_common.h"
Functions | |
lzma_ret | lzma_filters_copy (const lzma_filter *src, lzma_filter *real_dest, const lzma_allocator *allocator) |
Copy the filters array. More... | |
void | lzma_filters_free (lzma_filter *filters, const lzma_allocator *allocator) |
Free the options in the array of lzma_filter structures. More... | |
lzma_ret | lzma_validate_chain (const lzma_filter *filters, size_t *count) |
lzma_ret | lzma_raw_coder_init (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_filter *options, lzma_filter_find coder_find, bool is_encoder) |
uint64_t | lzma_raw_coder_memusage (lzma_filter_find coder_find, const lzma_filter *filters) |
Variables | |
struct { | |
lzma_vli id | |
Filter ID. More... | |
size_t options_size | |
Size of the filter-specific options structure. More... | |
bool non_last_ok | |
bool last_ok | |
bool changes_size | |
} | features [] |
Filter-specific stuff common for both encoder and decoder.
lzma_ret lzma_filters_copy | ( | const lzma_filter * | src, |
lzma_filter * | dest, | ||
const lzma_allocator * | allocator | ||
) |
Copy the filters array.
Copy the Filter IDs and filter-specific options from src to dest. Up to LZMA_FILTERS_MAX filters are copied, plus the terminating .id == LZMA_VLI_UNKNOWN. Thus, dest should have at least LZMA_FILTERS_MAX + 1 elements space unless the caller knows that src is smaller than that.
Unless the filter-specific options is NULL, the Filter ID has to be supported by liblzma, because liblzma needs to know the size of every filter-specific options structure. The filter-specific options are not validated. If options is NULL, any unsupported Filter IDs are copied without returning an error.
Old filter-specific options in dest are not freed, so dest doesn't need to be initialized by the caller in any way.
If an error occurs, memory possibly already allocated by this function is always freed. liblzma versions older than 5.2.7 may modify the dest array and leave its contents in an undefined state if an error occurs. liblzma 5.2.7 and newer only modify the dest array when returning LZMA_OK.
void lzma_filters_free | ( | lzma_filter * | filters, |
const lzma_allocator * | allocator | ||
) |
Free the options in the array of lzma_filter structures.
This frees the filter chain options. The filters array itself is not freed.
The filters array must have at most LZMA_FILTERS_MAX + 1 elements including the terminating element which must have .id = LZMA_VLI_UNKNOWN. For all elements before the terminating element:
If filters is NULL, this does nothing but remember that this never frees the filters array itself.
lzma_vli id |
Filter ID.
size_t options_size |
Size of the filter-specific options structure.
bool non_last_ok |
True if it is OK to use this filter as non-last filter in the chain.
bool last_ok |
True if it is OK to use this filter as the last filter in the chain.
bool changes_size |
True if the filter may change the size of the data (that is, the amount of encoded output can be different than the amount of uncompressed input).