block.h | block.h | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
* Some read some members, other functions write, and some do both. Only th e | * Some read some members, other functions write, and some do both. Only th e | |||
* members listed for reading need to be initialized when the specified | * members listed for reading need to be initialized when the specified | |||
* functions are called. The members marked for writing will be assigned | * functions are called. The members marked for writing will be assigned | |||
* new values at some point either by calling the given function or by | * new values at some point either by calling the given function or by | |||
* later calls to lzma_code(). | * later calls to lzma_code(). | |||
*/ | */ | |||
typedef struct { | typedef struct { | |||
/** | /** | |||
* \brief Block format version | * \brief Block format version | |||
* | * | |||
* To prevent API and ABI breakages if new features are needed in | * To prevent API and ABI breakages when new features are needed, | |||
* the Block field, a version number is used to indicate which | * a version number is used to indicate which fields in this | |||
* fields in this structure are in use. For now, version must always | * structure are in use: | |||
* be zero. With non-zero version, most Block related functions will | * - liblzma >= 5.0.0: version = 0 is supported. | |||
* return LZMA_OPTIONS_ERROR. | * - liblzma >= 5.1.4beta: Support for version = 1 was added, | |||
* which adds the ignore_check field. | ||||
* | ||||
* If version is greater than one, most Block related functions | ||||
* will return LZMA_OPTIONS_ERROR (lzma_block_header_decode() works | ||||
* with any version value). | ||||
* | * | |||
* Read by: | * Read by: | |||
* - All functions that take pointer to lzma_block as argument, | * - All functions that take pointer to lzma_block as argument, | |||
* including lzma_block_header_decode(). | * including lzma_block_header_decode(). | |||
* | * | |||
* Written by: | * Written by: | |||
* - lzma_block_header_decode() | * - lzma_block_header_decode() | |||
*/ | */ | |||
uint32_t version; | uint32_t version; | |||
skipping to change at line 235 | skipping to change at line 240 | |||
lzma_vli reserved_int3; | lzma_vli reserved_int3; | |||
lzma_vli reserved_int4; | lzma_vli reserved_int4; | |||
lzma_vli reserved_int5; | lzma_vli reserved_int5; | |||
lzma_vli reserved_int6; | lzma_vli reserved_int6; | |||
lzma_vli reserved_int7; | lzma_vli reserved_int7; | |||
lzma_vli reserved_int8; | lzma_vli reserved_int8; | |||
lzma_reserved_enum reserved_enum1; | lzma_reserved_enum reserved_enum1; | |||
lzma_reserved_enum reserved_enum2; | lzma_reserved_enum reserved_enum2; | |||
lzma_reserved_enum reserved_enum3; | lzma_reserved_enum reserved_enum3; | |||
lzma_reserved_enum reserved_enum4; | lzma_reserved_enum reserved_enum4; | |||
lzma_bool reserved_bool1; | ||||
/** | ||||
* \brief A flag to Block decoder to not verify the Check fiel | ||||
d | ||||
* | ||||
* This field is supported by liblzma >= 5.1.4beta if .version >= 1. | ||||
* | ||||
* If this is set to true, the integrity check won't be calculated | ||||
* and verified. Unless you know what you are doing, you should | ||||
* leave this to false. (A reason to set this to true is when the | ||||
* file integrity is verified externally anyway and you want to | ||||
* speed up the decompression, which matters mostly when using | ||||
* SHA-256 as the integrity check.) | ||||
* | ||||
* If .version >= 1, read by: | ||||
* - lzma_block_decoder() | ||||
* - lzma_block_buffer_decode() | ||||
* | ||||
* Written by (.version is ignored): | ||||
* - lzma_block_header_decode() always sets this to false | ||||
*/ | ||||
lzma_bool ignore_check; | ||||
lzma_bool reserved_bool2; | lzma_bool reserved_bool2; | |||
lzma_bool reserved_bool3; | lzma_bool reserved_bool3; | |||
lzma_bool reserved_bool4; | lzma_bool reserved_bool4; | |||
lzma_bool reserved_bool5; | lzma_bool reserved_bool5; | |||
lzma_bool reserved_bool6; | lzma_bool reserved_bool6; | |||
lzma_bool reserved_bool7; | lzma_bool reserved_bool7; | |||
lzma_bool reserved_bool8; | lzma_bool reserved_bool8; | |||
} lzma_block; | } lzma_block; | |||
skipping to change at line 308 | skipping to change at line 334 | |||
* - LZMA_PROG_ERROR: Invalid arguments, for example | * - LZMA_PROG_ERROR: Invalid arguments, for example | |||
* block->header_size is invalid or block->filters is NULL. | * block->header_size is invalid or block->filters is NULL. | |||
*/ | */ | |||
extern LZMA_API(lzma_ret) lzma_block_header_encode( | extern LZMA_API(lzma_ret) lzma_block_header_encode( | |||
const lzma_block *block, uint8_t *out) | const lzma_block *block, uint8_t *out) | |||
lzma_nothrow lzma_attr_warn_unused_result; | lzma_nothrow lzma_attr_warn_unused_result; | |||
/** | /** | |||
* \brief Decode Block Header | * \brief Decode Block Header | |||
* | * | |||
* block->version should be set to the highest value supported by the | * block->version should (usually) be set to the highest value supported | |||
* application; currently the only possible version is zero. This function | * by the application. If the application sets block->version to a value | |||
* will set version to the lowest value that still supports all the feature | * higher than supported by the current liblzma version, this function will | |||
s | * downgrade block->version to the highest value supported by it. Thus one | |||
* required by the Block Header. | * should check the value of block->version after calling this function if | |||
* block->version was set to a non-zero value and the application doesn't | ||||
* otherwise know that the liblzma version being used is new enough to | ||||
* support the specified block->version. | ||||
* | * | |||
* The size of the Block Header must have already been decoded with | * The size of the Block Header must have already been decoded with | |||
* lzma_block_header_size_decode() macro and stored to block->header_size. | * lzma_block_header_size_decode() macro and stored to block->header_size. | |||
* | * | |||
* The integrity check type from Stream Header must have been stored | ||||
* to block->check. | ||||
* | ||||
* block->filters must have been allocated, but they don't need to be | * block->filters must have been allocated, but they don't need to be | |||
* initialized (possible existing filter options are not freed). | * initialized (possible existing filter options are not freed). | |||
* | * | |||
* \param block Destination for Block options. | * \param block Destination for Block options. | |||
* \param allocator lzma_allocator for custom allocator functions. | * \param allocator lzma_allocator for custom allocator functions. | |||
* Set to NULL to use malloc() (and also free() | * Set to NULL to use malloc() (and also free() | |||
* if an error occurs). | * if an error occurs). | |||
* \param in Beginning of the input buffer. This must be | * \param in Beginning of the input buffer. This must be | |||
* at least block->header_size bytes. | * at least block->header_size bytes. | |||
* | * | |||
skipping to change at line 339 | skipping to change at line 372 | |||
* unsupported options such as unsupported filters. This can | * unsupported options such as unsupported filters. This can | |||
* happen also if block->version was set to a too low value | * happen also if block->version was set to a too low value | |||
* compared to what would be required to properly represent | * compared to what would be required to properly represent | |||
* the information stored in the Block Header. | * the information stored in the Block Header. | |||
* - LZMA_DATA_ERROR: Block Header is corrupt, for example, | * - LZMA_DATA_ERROR: Block Header is corrupt, for example, | |||
* the CRC32 doesn't match. | * the CRC32 doesn't match. | |||
* - LZMA_PROG_ERROR: Invalid arguments, for example | * - LZMA_PROG_ERROR: Invalid arguments, for example | |||
* block->header_size is invalid or block->filters is NULL. | * block->header_size is invalid or block->filters is NULL. | |||
*/ | */ | |||
extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block, | extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block, | |||
lzma_allocator *allocator, const uint8_t *in) | const lzma_allocator *allocator, const uint8_t *in) | |||
lzma_nothrow lzma_attr_warn_unused_result; | lzma_nothrow lzma_attr_warn_unused_result; | |||
/** | /** | |||
* \brief Validate and set Compressed Size according to Unpadded Size | * \brief Validate and set Compressed Size according to Unpadded Size | |||
* | * | |||
* Block Header stores Compressed Size, but Index has Unpadded Size. If the | * Block Header stores Compressed Size, but Index has Unpadded Size. If the | |||
* application has already parsed the Index and is now decoding Blocks, | * application has already parsed the Index and is now decoding Blocks, | |||
* it can calculate Compressed Size from Unpadded Size. This function does | * it can calculate Compressed Size from Unpadded Size. This function does | |||
* exactly that with error checking: | * exactly that with error checking: | |||
* | * | |||
skipping to change at line 481 | skipping to change at line 514 | |||
* | * | |||
* \return - LZMA_OK: Encoding was successful. | * \return - LZMA_OK: Encoding was successful. | |||
* - LZMA_BUF_ERROR: Not enough output buffer space. | * - LZMA_BUF_ERROR: Not enough output buffer space. | |||
* - LZMA_UNSUPPORTED_CHECK | * - LZMA_UNSUPPORTED_CHECK | |||
* - LZMA_OPTIONS_ERROR | * - LZMA_OPTIONS_ERROR | |||
* - LZMA_MEM_ERROR | * - LZMA_MEM_ERROR | |||
* - LZMA_DATA_ERROR | * - LZMA_DATA_ERROR | |||
* - LZMA_PROG_ERROR | * - LZMA_PROG_ERROR | |||
*/ | */ | |||
extern LZMA_API(lzma_ret) lzma_block_buffer_encode( | extern LZMA_API(lzma_ret) lzma_block_buffer_encode( | |||
lzma_block *block, lzma_allocator *allocator, | 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) | ||||
lzma_nothrow lzma_attr_warn_unused_result; | ||||
/** | ||||
* \brief Single-call uncompressed .xz Block encoder | ||||
* | ||||
* This is like lzma_block_buffer_encode() except this doesn't try to | ||||
* compress the data and instead encodes the data using LZMA2 uncompressed | ||||
* chunks. The required output buffer size can be determined with | ||||
* lzma_block_buffer_bound(). | ||||
* | ||||
* Since the data won't be compressed, this function ignores block->filters | ||||
. | ||||
* This function doesn't take lzma_allocator because this function doesn't | ||||
* allocate any memory from the heap. | ||||
*/ | ||||
extern LZMA_API(lzma_ret) lzma_block_uncomp_encode(lzma_block *block, | ||||
const uint8_t *in, size_t in_size, | const uint8_t *in, size_t in_size, | |||
uint8_t *out, size_t *out_pos, size_t out_size) | uint8_t *out, size_t *out_pos, size_t out_size) | |||
lzma_nothrow lzma_attr_warn_unused_result; | lzma_nothrow lzma_attr_warn_unused_result; | |||
/** | /** | |||
* \brief Single-call .xz Block decoder | * \brief Single-call .xz Block decoder | |||
* | * | |||
* This is single-call equivalent of lzma_block_decoder(), and requires tha t | * This is single-call equivalent of lzma_block_decoder(), and requires tha t | |||
* the caller has already decoded Block Header and checked its memory usage . | * the caller has already decoded Block Header and checked its memory usage . | |||
* | * | |||
skipping to change at line 514 | skipping to change at line 564 | |||
* which no data is written to is out[out_size]. | * which no data is written to is out[out_size]. | |||
* | * | |||
* \return - LZMA_OK: Decoding was successful. | * \return - LZMA_OK: Decoding was successful. | |||
* - LZMA_OPTIONS_ERROR | * - LZMA_OPTIONS_ERROR | |||
* - LZMA_DATA_ERROR | * - LZMA_DATA_ERROR | |||
* - LZMA_MEM_ERROR | * - LZMA_MEM_ERROR | |||
* - LZMA_BUF_ERROR: Output buffer was too small. | * - LZMA_BUF_ERROR: Output buffer was too small. | |||
* - LZMA_PROG_ERROR | * - LZMA_PROG_ERROR | |||
*/ | */ | |||
extern LZMA_API(lzma_ret) lzma_block_buffer_decode( | extern LZMA_API(lzma_ret) lzma_block_buffer_decode( | |||
lzma_block *block, lzma_allocator *allocator, | lzma_block *block, const lzma_allocator *allocator, | |||
const uint8_t *in, size_t *in_pos, size_t in_size, | const uint8_t *in, size_t *in_pos, size_t in_size, | |||
uint8_t *out, size_t *out_pos, size_t out_size) | uint8_t *out, size_t *out_pos, size_t out_size) | |||
lzma_nothrow; | lzma_nothrow; | |||
End of changes. 7 change blocks. | ||||
14 lines changed or deleted | 65 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |