Functions | Variables

/tmp/buildd/xz-utils-5.0.0/src/liblzma/common/filter_common.c File Reference

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 *dest, lzma_allocator *allocator)
 Copy the filters array.
static lzma_ret validate_chain (const lzma_filter *filters, size_t *count)
lzma_ret lzma_raw_coder_init (lzma_next_coder *next, 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.
   size_t   options_size
 Size of the filter-specific options structure.
   bool   non_last_ok
   bool   last_ok
   bool   changes_size
features []

Detailed Description

Filter-specific stuff common for both encoder and decoder.


Function Documentation

lzma_ret lzma_filters_copy ( const lzma_filter src,
lzma_filter dest,
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.

Returns:
- LZMA_OK
  • LZMA_MEM_ERROR
  • LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options is not NULL.
  • LZMA_PROG_ERROR: src or dest is NULL.

References lzma_alloc(), LZMA_FILTERS_MAX, LZMA_VLI_UNKNOWN, and options_size.


Variable Documentation

Filter ID.

size_t options_size

Size of the filter-specific options structure.

Referenced by lzma_filters_copy().

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.

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).