Rizin
unix-like reverse engineering framework and cli tools
index_encoder.h File Reference

Encodes the Index field. More...

#include "common.h"

Go to the source code of this file.

Functions

lzma_ret lzma_index_encoder_init (lzma_next_coder *next, const lzma_allocator *allocator, const lzma_index *i)
 

Detailed Description

Encodes the Index field.

Definition in file index_encoder.h.

Function Documentation

◆ lzma_index_encoder_init()

lzma_ret lzma_index_encoder_init ( lzma_next_coder next,
const lzma_allocator allocator,
const lzma_index i 
)

Definition at line 186 of file index_encoder.c.

188 {
190 
191  if (i == NULL)
192  return LZMA_PROG_ERROR;
193 
194  if (next->coder == NULL) {
195  next->coder = lzma_alloc(sizeof(lzma_index_coder), allocator);
196  if (next->coder == NULL)
197  return LZMA_MEM_ERROR;
198 
199  next->code = &index_encode;
200  next->end = &index_encoder_end;
201  }
202 
203  index_encoder_reset(next->coder, i);
204 
205  return LZMA_OK;
206 }
lzma_index ** i
Definition: index.h:629
const lzma_allocator * allocator
Definition: block.h:377
#define NULL
Definition: cris-opc.c:27
static lzma_ret index_encode(void *coder_ptr, const 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__)))
Definition: index_encoder.c:44
lzma_ret lzma_index_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator, const lzma_index *i)
static void index_encoder_reset(lzma_index_coder *coder, const lzma_index *i)
static void index_encoder_end(void *coder, const lzma_allocator *allocator)
lzma_code_function code
Pointer to function to do the actual coding.
Definition: common.h:150
void * coder
Pointer to coder-specific data.
Definition: common.h:137
lzma_end_function end
Definition: common.h:155
#define lzma_next_coder_init(func, next, allocator)
Definition: common.h:291
void * lzma_alloc(size_t size, const lzma_allocator *allocator) lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
Allocates memory.
@ LZMA_PROG_ERROR
Programming error.
Definition: base.h:218
@ LZMA_MEM_ERROR
Cannot allocate memory.
Definition: base.h:128
@ LZMA_OK
Operation completed successfully.
Definition: base.h:58

References allocator, lzma_next_coder_s::code, lzma_next_coder_s::coder, lzma_next_coder_s::end, i, index_encode(), index_encoder_end(), index_encoder_reset(), lzma_alloc(), LZMA_MEM_ERROR, lzma_next_coder_init, LZMA_OK, LZMA_PROG_ERROR, and NULL.

Referenced by LZMA_API(), stream_encode(), and stream_encode_mt().