Rizin
unix-like reverse engineering framework and cli tools
|
Single-call .xz Block encoder. More...
#include "block_buffer_encoder.h"
#include "block_encoder.h"
#include "filter_encoder.h"
#include "lzma2_encoder.h"
#include "check.h"
Go to the source code of this file.
Macros | |
#define | HEADERS_BOUND |
Functions | |
static uint64_t | lzma2_bound (uint64_t uncompressed_size) |
uint64_t | lzma_block_buffer_bound64 (uint64_t uncompressed_size) |
LZMA_API (size_t) | |
Calculate maximum output size for single-call Block encoding. More... | |
static lzma_ret | block_encode_uncompressed (lzma_block *block, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) |
static lzma_ret | block_encode_normal (lzma_block *block, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size) |
static lzma_ret | block_buffer_encode (lzma_block *block, const lzma_allocator *allocator, const uint8_t *in, size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size, bool try_to_compress) |
LZMA_API (lzma_ret) | |
Single-call .xz Block encoder.
Definition in file block_buffer_encoder.c.
#define HEADERS_BOUND |
Estimate the maximum size of the Block Header and Check fields for a Block that uses LZMA2 uncompressed chunks. We could use lzma_block_header_size() but this is simpler.
Block Header Size + Block Flags + Compressed Size
Definition at line 28 of file block_buffer_encoder.c.
|
static |
Definition at line 224 of file block_buffer_encoder.c.
References allocator, assert(), block_encode_normal(), block_encode_uncompressed(), lzma_block::check, check, lzma_block::compressed_size, lzma_block::filters, i, in, in_size, lzma2_bound(), LZMA_BUF_ERROR, lzma_check_finish(), LZMA_CHECK_ID_MAX, lzma_check_init(), lzma_check_update(), LZMA_DATA_ERROR, LZMA_OK, LZMA_OPTIONS_ERROR, LZMA_PROG_ERROR, LZMA_UNSUPPORTED_CHECK, memcpy(), NULL, out, out_pos, lzma_block::raw_check, return_if_error, UINT32_MAX, lzma_block::uncompressed_size, and lzma_block::version.
Referenced by LZMA_API().
|
static |
Definition at line 167 of file block_buffer_encoder.c.
References allocator, lzma_next_coder_s::code, lzma_next_coder_s::coder, lzma_block::compressed_size, lzma_block::filters, lzma_block::header_size, in, in_pos, in_size, LZMA_BUF_ERROR, LZMA_FINISH, LZMA_NEXT_CODER_INIT, lzma_next_end(), LZMA_OK, LZMA_PROG_ERROR, lzma_raw_encoder_init(), LZMA_STREAM_END, out, out_pos, and return_if_error.
Referenced by block_buffer_encode().
|
static |
Definition at line 89 of file block_buffer_encoder.c.
References assert(), lzma_block::compressed_size, control, lzma_options_lzma::dict_size, lzma_block::filters, filters, lzma_block::header_size, lzma_filter::id, in, in_pos, in_size, lzma2_bound(), LZMA2_CHUNK_MAX, LZMA_BUF_ERROR, LZMA_DICT_SIZE_MIN, LZMA_FILTER_LZMA2, LZMA_OK, LZMA_PROG_ERROR, LZMA_VLI_UNKNOWN, memcpy(), my_min, lzma_filter::options, out, and out_pos.
Referenced by block_buffer_encode().
Definition at line 33 of file block_buffer_encoder.c.
References COMPRESSED_SIZE_MAX, LZMA2_CHUNK_MAX, LZMA2_HEADER_UNCOMPRESSED, and uncompressed_size.
Referenced by block_buffer_encode(), block_encode_uncompressed(), and lzma_block_buffer_bound64().
LZMA_API | ( | lzma_ret | ) |
Definition at line 318 of file block_buffer_encoder.c.
References allocator, block_buffer_encode(), in, in_size, out, and out_pos.
LZMA_API | ( | size_t | ) |
Calculate maximum output size for single-call Block encoding.
Calculate output buffer size for single-call Stream encoder.
This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks. See the documentation of lzma_stream_buffer_bound().
Definition at line 73 of file block_buffer_encoder.c.
uint64_t version of lzma_block_buffer_bound(). It is used by stream_encoder_mt.c. Probably the original lzma_block_buffer_bound() should have been 64-bit, but fixing it would break the ABI.
Definition at line 56 of file block_buffer_encoder.c.
References HEADERS_BOUND, lzma2_bound(), UINT64_C, and uncompressed_size.
Referenced by get_options(), and LZMA_API().