1207753Smm/////////////////////////////////////////////////////////////////////////////// 2207753Smm// 3207753Smm/// \file block_encoder.h 4207753Smm/// \brief Encodes .xz Blocks 5207753Smm// 6207753Smm// Author: Lasse Collin 7207753Smm// 8207753Smm// This file has been put into the public domain. 9207753Smm// You can do whatever you want with this file. 10207753Smm// 11207753Smm/////////////////////////////////////////////////////////////////////////////// 12207753Smm 13207753Smm#ifndef LZMA_BLOCK_ENCODER_H 14207753Smm#define LZMA_BLOCK_ENCODER_H 15207753Smm 16207753Smm#include "common.h" 17207753Smm 18207753Smm 19207753Smm/// \brief Biggest Compressed Size value that the Block encoder supports 20207753Smm/// 21207753Smm/// The maximum size of a single Block is limited by the maximum size of 22207753Smm/// a Stream, which in theory is 2^63 - 3 bytes (i.e. LZMA_VLI_MAX - 3). 23207753Smm/// While the size is really big and no one should hit it in practice, we 24207753Smm/// take it into account in some places anyway to catch some errors e.g. if 25207753Smm/// application passes insanely big value to some function. 26207753Smm/// 27207753Smm/// We could take into account the headers etc. to determine the exact 28207753Smm/// maximum size of the Compressed Data field, but the complexity would give 29207753Smm/// us nothing useful. Instead, limit the size of Compressed Data so that 30207753Smm/// even with biggest possible Block Header and Check fields the total 31207753Smm/// encoded size of the Block stays as a valid VLI. This doesn't guarantee 32207753Smm/// that the size of the Stream doesn't grow too big, but that problem is 33207753Smm/// taken care outside the Block handling code. 34207753Smm/// 35207753Smm/// ~LZMA_VLI_C(3) is to guarantee that if we need padding at the end of 36207753Smm/// the Compressed Data field, it will still stay in the proper limit. 37207753Smm/// 38207753Smm/// This constant is in this file because it is needed in both 39207753Smm/// block_encoder.c and block_buffer_encoder.c. 40207753Smm#define COMPRESSED_SIZE_MAX ((LZMA_VLI_MAX - LZMA_BLOCK_HEADER_SIZE_MAX \ 41207753Smm - LZMA_CHECK_SIZE_MAX) & ~LZMA_VLI_C(3)) 42207753Smm 43207753Smm 44207753Smmextern lzma_ret lzma_block_encoder_init(lzma_next_coder *next, 45207753Smm lzma_allocator *allocator, lzma_block *block); 46207753Smm 47207753Smm#endif 48