Rizin
unix-like reverse engineering framework and cli tools
|
Encodes .xz Blocks. More...
#include "common.h"
Go to the source code of this file.
Macros | |
#define | COMPRESSED_SIZE_MAX |
Biggest Compressed Size value that the Block encoder supports. More... | |
Functions | |
lzma_ret | lzma_block_encoder_init (lzma_next_coder *next, const lzma_allocator *allocator, lzma_block *block) |
Encodes .xz Blocks.
Definition in file block_encoder.h.
#define COMPRESSED_SIZE_MAX |
Biggest Compressed Size value that the Block encoder supports.
The maximum size of a single Block is limited by the maximum size of a Stream, which in theory is 2^63 - 3 bytes (i.e. LZMA_VLI_MAX - 3). While the size is really big and no one should hit it in practice, we take it into account in some places anyway to catch some errors e.g. if application passes insanely big value to some function.
We could take into account the headers etc. to determine the exact maximum size of the Compressed Data field, but the complexity would give us nothing useful. Instead, limit the size of Compressed Data so that even with biggest possible Block Header and Check fields the total encoded size of the Block stays as a valid VLI. This doesn't guarantee that the size of the Stream doesn't grow too big, but that problem is taken care outside the Block handling code.
~LZMA_VLI_C(3) is to guarantee that if we need padding at the end of the Compressed Data field, it will still stay in the proper limit.
This constant is in this file because it is needed in both block_encoder.c and block_buffer_encoder.c.
Definition at line 40 of file block_encoder.h.
lzma_ret lzma_block_encoder_init | ( | lzma_next_coder * | next, |
const lzma_allocator * | allocator, | ||
lzma_block * | block | ||
) |
Definition at line 164 of file block_encoder.c.
References allocator, lzma_block_coder::block, block_encode(), block_encoder_end(), block_encoder_update(), lzma_block::check, lzma_block_coder::check, lzma_next_coder_s::code, lzma_next_coder_s::coder, lzma_block_coder::compressed_size, lzma_next_coder_s::end, lzma_block::filters, lzma_alloc(), LZMA_CHECK_ID_MAX, lzma_check_init(), LZMA_MEM_ERROR, LZMA_NEXT_CODER_INIT, lzma_next_coder_init, LZMA_OPTIONS_ERROR, LZMA_PROG_ERROR, lzma_raw_encoder_init(), LZMA_UNSUPPORTED_CHECK, lzma_block_coder::next, NULL, lzma_block_coder::pos, lzma_block_coder::sequence, lzma_block_coder::uncompressed_size, lzma_next_coder_s::update, and lzma_block::version.
Referenced by block_encoder_init(), LZMA_API(), and worker_encode().