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

Encodes the Index field. More...

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

Data Structures

struct  lzma_coder_s

Functions

static lzma_ret index_encode (lzma_coder *coder, lzma_allocator *allocator lzma_attribute((unused)), const uint8_t *restrict in lzma_attribute((unused)), size_t *restrict in_pos lzma_attribute((unused)), size_t in_size lzma_attribute((unused)), uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action lzma_attribute((unused)))
static void index_encoder_end (lzma_coder *coder, lzma_allocator *allocator)
static void index_encoder_reset (lzma_coder *coder, lzma_index *i)
lzma_ret lzma_index_encoder_init (lzma_next_coder *next, lzma_allocator *allocator, lzma_index *i)
lzma_ret lzma_index_encoder (lzma_stream *strm, lzma_index *i)
 Initialize .xz Index encoder.
lzma_ret lzma_index_buffer_encode (lzma_index *i, uint8_t *out, size_t *out_pos, size_t out_size)
 Single-call .xz Index encoder.

Detailed Description

Encodes the Index field.


Function Documentation

lzma_ret lzma_index_encoder ( lzma_stream strm,
lzma_index i 
)

Initialize .xz Index encoder.

Parameters:
strm Pointer to properly prepared lzma_stream
i Pointer to lzma_index which should be encoded. The read position will be at the end of the Index after lzma_code() has returned LZMA_STREAM_END.

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

Returns:
- LZMA_OK: Initialization succeeded, continue with lzma_code().
  • LZMA_MEM_ERROR
  • LZMA_PROG_ERROR

References lzma_next_strm_init, LZMA_OK, and LZMA_RUN.

lzma_ret lzma_index_buffer_encode ( lzma_index i,
uint8_t *  out,
size_t *  out_pos,
size_t  out_size 
)

Single-call .xz Index encoder.

Parameters:
i Index to be encoded. The read position will be at the end of the Index if encoding succeeds, or at unspecified position in case an error occurs.
out Beginning of the output buffer
out_pos The next byte will be written to out[*out_pos]. *out_pos is updated only if encoding succeeds.
out_size Size of the out buffer; the first byte into which no data is written to is out[out_size].
Returns:
- LZMA_OK: Encoding was successful.
  • LZMA_BUF_ERROR: Output buffer is too small. Use lzma_index_size() to find out how much output space is needed.
  • LZMA_PROG_ERROR
Note:
This function doesn't take allocator argument since all the internal data is allocated on stack.

References LZMA_BUF_ERROR, lzma_index_size(), LZMA_OK, LZMA_PROG_ERROR, LZMA_RUN, and LZMA_STREAM_END.

Referenced by lzma_stream_buffer_encode().


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