Data Structures | Functions | Variables

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

Filter ID mapping to filter-specific functions. More...

#include "filter_decoder.h"
#include "filter_common.h"
#include "lzma_decoder.h"
#include "lzma2_decoder.h"
#include "simple_decoder.h"
#include "delta_decoder.h"

Data Structures

struct  lzma_filter_decoder

Functions

static const lzma_filter_decoderdecoder_find (lzma_vli id)
lzma_bool lzma_filter_decoder_is_supported (lzma_vli id)
 Test if the given Filter ID is supported for decoding.
lzma_ret lzma_raw_decoder_init (lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter *options)
lzma_ret lzma_raw_decoder (lzma_stream *strm, const lzma_filter *options)
 Initialize raw decoder.
uint64_t lzma_raw_decoder_memusage (const lzma_filter *filters)
 Calculate approximate memory requirements for raw decoder.
lzma_ret lzma_properties_decode (lzma_filter *filter, lzma_allocator *allocator, const uint8_t *props, size_t props_size)
 Decode the Filter Properties field.

Variables

static const lzma_filter_decoder decoders []

Detailed Description

Filter ID mapping to filter-specific functions.


Function Documentation

lzma_bool lzma_filter_decoder_is_supported ( lzma_vli  id  )  const

Test if the given Filter ID is supported for decoding.

Return true if the give Filter ID is supported for decoding by this liblzma build. Otherwise false is returned.

lzma_ret lzma_raw_decoder ( lzma_stream strm,
const lzma_filter filters 
)

Initialize raw decoder.

The initialization of raw decoder goes similarly to raw encoder.

The `action' with lzma_code() can be LZMA_RUN or LZMA_FINISH. Using LZMA_FINISH is not required, it is supported just for convenience.

Returns:
- LZMA_OK
  • LZMA_MEM_ERROR
  • LZMA_OPTIONS_ERROR
  • LZMA_PROG_ERROR

References lzma_next_strm_init.

Referenced by coder_init().

uint64_t lzma_raw_decoder_memusage ( const lzma_filter filters  ) 

Calculate approximate memory requirements for raw decoder.

This function can be used to calculate the memory requirements for Block and Stream decoders too because Block and Stream decoders don't need significantly more memory than raw decoder.

Parameters:
filters Array of filters terminated with .id == LZMA_VLI_UNKNOWN.
Returns:
Number of bytes of memory required for the given filter chain when decoding.

Referenced by lzma_easy_decoder_memusage(), and parse_block_header().

lzma_ret lzma_properties_decode ( lzma_filter filter,
lzma_allocator allocator,
const uint8_t *  props,
size_t  props_size 
)

Decode the Filter Properties field.

Parameters:
filter filter->id must have been set to the correct Filter ID. filter->options doesn't need to be initialized (it's not freed by this function). The decoded options will be stored to filter->options. filter->options is set to NULL if there are no properties or if an error occurs.
allocator Custom memory allocator used to allocate the options. Set to NULL to use the default malloc(), and in case of an error, also free().
props Input buffer containing the properties.
props_size Size of the properties. This must be the exact size; giving too much or too little input will return LZMA_OPTIONS_ERROR.
Returns:
- LZMA_OK
  • LZMA_OPTIONS_ERROR
  • LZMA_MEM_ERROR

References LZMA_OK, and lzma_filter_decoder::props_decode.

Referenced by is_format_lzma(), lzma_filter_flags_decode(), and lzmainfo().