Functions

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

Decodes Block Header from .xz files. More...

#include "common.h"
#include "check.h"

Functions

static void free_properties (lzma_block *block, lzma_allocator *allocator)
lzma_ret lzma_block_header_decode (lzma_block *block, lzma_allocator *allocator, const uint8_t *in)
 Decode Block Header.

Detailed Description

Decodes Block Header from .xz files.


Function Documentation

lzma_ret lzma_block_header_decode ( lzma_block block,
lzma_allocator allocator,
const uint8_t *  in 
)

Decode Block Header.

block->version should be set to the highest value supported by the application; currently the only possible version is zero. This function will set version to the lowest value that still supports all the features required by the Block Header.

The size of the Block Header must have already been decoded with lzma_block_header_size_decode() macro and stored to block->header_size.

block->filters must have been allocated, but they don't need to be initialized (possible existing filter options are not freed).

Parameters:
block Destination for Block options.
allocator lzma_allocator for custom allocator functions. Set to NULL to use malloc() (and also free() if an error occurs).
in Beginning of the input buffer. This must be at least block->header_size bytes.
Returns:
- LZMA_OK: Decoding was successful. block->header_size bytes were read from the input buffer.
  • LZMA_OPTIONS_ERROR: The Block Header specifies some unsupported options such as unsupported filters. This can happen also if block->version was set to a too low value compared to what would be required to properly represent the information stored in the Block Header.
  • LZMA_DATA_ERROR: Block Header is corrupt, for example, the CRC32 doesn't match.
  • LZMA_PROG_ERROR: Invalid arguments, for example block->header_size is invalid or block->filters is NULL.

References lzma_block_header_size_decode, lzma_block_unpadded_size(), LZMA_CHECK_ID_MAX, lzma_crc32(), lzma_filter_flags_decode(), LZMA_OK, lzma_vli_decode(), and return_if_error.

Referenced by parse_block_header().