/build/buildd/xz-utils-4.999.9beta+20091116/src/liblzma/common/index_decoder.c File Reference

Decodes the Index field. More...

#include "index.h"
#include "check.h"

Data Structures

struct  lzma_coder_s

Functions

static lzma_ret index_decode (lzma_coder *coder, lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out lzma_attribute((unused)), size_t *restrict out_pos lzma_attribute((unused)), size_t out_size lzma_attribute((unused)), lzma_action action lzma_attribute((unused)))
static void index_decoder_end (lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret index_decoder_memconfig (lzma_coder *coder, uint64_t *memusage, uint64_t *old_memlimit, uint64_t new_memlimit)
static lzma_ret index_decoder_reset (lzma_coder *coder, lzma_allocator *allocator, lzma_index **i, uint64_t memlimit)
static lzma_ret index_decoder_init (lzma_next_coder *next, lzma_allocator *allocator, lzma_index **i, uint64_t memlimit)
lzma_ret lzma_index_decoder (lzma_stream *strm, lzma_index **i, uint64_t memlimit)
 Initialize .xz Index decoder.
lzma_ret lzma_index_buffer_decode (lzma_index **i, uint64_t *memlimit, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size)
 Single-call .xz Index decoder.

Detailed Description

Decodes the Index field.


Function Documentation

lzma_ret lzma_index_decoder ( lzma_stream strm,
lzma_index **  i,
uint64_t  memlimit 
)

Initialize .xz Index decoder.

Parameters:
strm Pointer to properly prepared lzma_stream
i Pointer to a pointer that will be made to point to the final decoded Index once lzma_code() has returned LZMA_STREAM_END. That is, lzma_index_decoder() always takes care of allocating a new lzma_index structure, and *i doesn't need to be initialized by the caller.
memlimit How much memory the resulting Index is allowed to require.

The only valid action value for lzma_code() is LZMA_RUN.

Returns:
- LZMA_OK: Initialization succeeded, continue with lzma_code().
  • LZMA_MEM_ERROR
  • LZMA_MEMLIMIT_ERROR
  • LZMA_PROG_ERROR
Note:
The memory usage limit is checked early in the decoding (within the first dozen input bytes or so). The actual memory is allocated later in smaller pieces. If the memory usage limit is modified with lzma_memlimit_set() after a part of the Index has already been decoded, the new limit may get ignored.

References lzma_next_strm_init, LZMA_OK, and LZMA_RUN.

lzma_ret lzma_index_buffer_decode ( lzma_index **  i,
uint64_t *  memlimit,
lzma_allocator allocator,
const uint8_t *  in,
size_t *  in_pos,
size_t  in_size 
)

Single-call .xz Index decoder.

Parameters:
i Pointer to a pointer that will be made to point to the final decoded Index if decoding is successful. That is, lzma_index_buffer_decode() always takes care of allocating a new lzma_index structure, and *i doesn't need to be initialized by the caller.
memlimit Pointer to how much memory the resulting Index is allowed to require. The value pointed by this pointer is modified if and only if LZMA_MEMLIMIT_ERROR is returned.
allocator Pointer to lzma_allocator, or NULL to use malloc()
in Beginning of the input buffer
in_pos The next byte will be read from in[*in_pos]. *in_pos is updated only if decoding succeeds.
in_size Size of the input buffer; the first byte that won't be read is in[in_size].
Returns:
- LZMA_OK: Decoding was successful.
  • LZMA_MEM_ERROR
  • LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. The minimum required memlimit value was stored to *memlimit.
  • LZMA_DATA_ERROR
  • LZMA_PROG_ERROR

References lzma_coder_s::count, LZMA_DATA_ERROR, lzma_index_end(), lzma_index_memusage(), LZMA_OK, LZMA_PROG_ERROR, LZMA_RUN, LZMA_STREAM_END, and return_if_error.


Generated on Mon Dec 21 22:54:40 2009 for XZ Utils by  doxygen 1.6.1