diff options
Diffstat (limited to 'contrib/xz/src/liblzma/api/lzma/container.h')
-rw-r--r-- | contrib/xz/src/liblzma/api/lzma/container.h | 217 |
1 files changed, 140 insertions, 77 deletions
diff --git a/contrib/xz/src/liblzma/api/lzma/container.h b/contrib/xz/src/liblzma/api/lzma/container.h index 6e432a1f3b14..48a643651f3d 100644 --- a/contrib/xz/src/liblzma/api/lzma/container.h +++ b/contrib/xz/src/liblzma/api/lzma/container.h @@ -1,6 +1,7 @@ /** * \file lzma/container.h * \brief File formats + * \note Never include this file directly. Use <lzma.h> instead. */ /* @@ -8,8 +9,6 @@ * * This file has been put into the public domain. * You can do whatever you want with this file. - * - * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL @@ -51,7 +50,7 @@ * * This flag modifies the preset to make the encoding significantly slower * while improving the compression ratio only marginally. This is useful - * when you don't mind wasting time to get as small result as possible. + * when you don't mind spending time to get as small result as possible. * * This flag doesn't affect the memory usage requirements of the decoder (at * least not significantly). The memory usage of the encoder may be increased @@ -72,9 +71,12 @@ typedef struct { * Encoder: No flags are currently supported. * * Decoder: Bitwise-or of zero or more of the decoder flags: - * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, - * LZMA_TELL_ANY_CHECK, LZMA_IGNORE_CHECK, - * LZMA_CONCATENATED, LZMA_FAIL_FAST + * - LZMA_TELL_NO_CHECK + * - LZMA_TELL_UNSUPPORTED_CHECK + * - LZMA_TELL_ANY_CHECK + * - LZMA_IGNORE_CHECK + * - LZMA_CONCATENATED + * - LZMA_FAIL_FAST */ uint32_t flags; @@ -111,7 +113,7 @@ typedef struct { /** * \brief Timeout to allow lzma_code() to return early * - * Multithreading can make liblzma to consume input and produce + * Multithreading can make liblzma consume input and produce * output in a very bursty way: it may first read a lot of input * to fill internal buffers, then no input or output occurs for * a while. @@ -128,14 +130,13 @@ typedef struct { * LZMA_OK. Reasonable values are 100 ms or more. The xz command * line tool uses 300 ms. * - * If long blocking times are fine for you, set timeout to a special - * value of 0, which will disable the timeout mechanism and will make + * If long blocking times are acceptable, set timeout to a special + * value of 0. This will disable the timeout mechanism and will make * lzma_code() block until all the input is consumed or the output * buffer has been filled. * * \note Even with a timeout, lzma_code() might sometimes take - * somewhat long time to return. No timing guarantees - * are made. + * a long time to return. No timing guarantees are made. */ uint32_t timeout; @@ -171,12 +172,25 @@ typedef struct { * with the currently supported options, so it is safe to leave these * uninitialized. */ + /** \private Reserved member. */ lzma_reserved_enum reserved_enum1; + + /** \private Reserved member. */ lzma_reserved_enum reserved_enum2; + + /** \private Reserved member. */ lzma_reserved_enum reserved_enum3; + + /** \private Reserved member. */ uint32_t reserved_int1; + + /** \private Reserved member. */ uint32_t reserved_int2; + + /** \private Reserved member. */ uint32_t reserved_int3; + + /** \private Reserved member. */ uint32_t reserved_int4; /** @@ -222,11 +236,22 @@ typedef struct { */ uint64_t memlimit_stop; + /** \private Reserved member. */ uint64_t reserved_int7; + + /** \private Reserved member. */ uint64_t reserved_int8; + + /** \private Reserved member. */ void *reserved_ptr1; + + /** \private Reserved member. */ void *reserved_ptr2; + + /** \private Reserved member. */ void *reserved_ptr3; + + /** \private Reserved member. */ void *reserved_ptr4; } lzma_mt; @@ -240,8 +265,7 @@ typedef struct { * \param preset Compression preset (level and possible flags) * * \return Number of bytes of memory required for the given - * preset when encoding. If an error occurs, for example - * due to unsupported preset, UINT64_MAX is returned. + * preset when encoding or UINT64_MAX on error. */ extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure; @@ -255,9 +279,8 @@ extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset) * \param preset Compression preset (level and possible flags) * * \return Number of bytes of memory required to decompress a file - * that was compressed using the given preset. If an error - * occurs, for example due to unsupported preset, UINT64_MAX - * is returned. + * that was compressed using the given preset or UINT64_MAX + * on error. */ extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure; @@ -267,7 +290,16 @@ extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset) * \brief Initialize .xz Stream encoder using a preset number * * This function is intended for those who just want to use the basic features - * if liblzma (that is, most developers out there). + * of liblzma (that is, most developers out there). + * + * If initialization fails (return value is not LZMA_OK), all the memory + * allocated for *strm by liblzma is always freed. Thus, there is no need + * to call lzma_end() after failed initialization. + * + * If initialization succeeds, use lzma_code() to do the actual encoding. + * Valid values for `action' (the second argument of lzma_code()) are + * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future, + * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH. * * \param strm Pointer to lzma_stream that is at least initialized * with LZMA_STREAM_INIT. @@ -283,7 +315,8 @@ extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset) * unsure. LZMA_CHECK_CRC32 is good too as long as the * uncompressed file is not many gigabytes. * - * \return - LZMA_OK: Initialization succeeded. Use lzma_code() to + * \return Possible lzma_ret values: + * - LZMA_OK: Initialization succeeded. Use lzma_code() to * encode your data. * - LZMA_MEM_ERROR: Memory allocation failed. * - LZMA_OPTIONS_ERROR: The given compression preset is not @@ -292,15 +325,6 @@ extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset) * supported by this liblzma build. * - LZMA_PROG_ERROR: One or more of the parameters have values * that will never be valid. For example, strm == NULL. - * - * If initialization fails (return value is not LZMA_OK), all the memory - * allocated for *strm by liblzma is always freed. Thus, there is no need - * to call lzma_end() after failed initialization. - * - * If initialization succeeds, use lzma_code() to do the actual encoding. - * Valid values for `action' (the second argument of lzma_code()) are - * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future, - * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH. */ extern LZMA_API(lzma_ret) lzma_easy_encoder( lzma_stream *strm, uint32_t preset, lzma_check check) @@ -321,13 +345,14 @@ extern LZMA_API(lzma_ret) lzma_easy_encoder( * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_size Size of the input buffer - * \param out Beginning of the output buffer - * \param out_pos The next byte will be written to out[*out_pos]. + * \param[out] out Beginning of the output buffer + * \param[out] out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * - * \return - LZMA_OK: Encoding was successful. + * \return Possible lzma_ret values: + * - LZMA_OK: Encoding was successful. * - LZMA_BUF_ERROR: Not enough output buffer space. * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR @@ -345,14 +370,16 @@ extern LZMA_API(lzma_ret) lzma_easy_buffer_encode( /** * \brief Initialize .xz Stream encoder using a custom filter chain * - * \param strm Pointer to properly prepared lzma_stream - * \param filters Array of filters. This must be terminated with - * filters[n].id = LZMA_VLI_UNKNOWN. See filter.h for - * more information. + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * \param filters Array of filters terminated with + * .id == LZMA_VLI_UNKNOWN. See filters.h for more + * information. * \param check Type of the integrity check to calculate from * uncompressed data. * - * \return - LZMA_OK: Initialization was successful. + * \return Possible lzma_ret values: + * - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR @@ -392,10 +419,12 @@ extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage( * LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be * added in the future. * - * \param strm Pointer to properly prepared lzma_stream + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. * \param options Pointer to multithreaded compression options * - * \return - LZMA_OK + * \return Possible lzma_ret values: + * - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR @@ -421,7 +450,12 @@ extern LZMA_API(lzma_ret) lzma_stream_encoder_mt( * No kind of flushing is supported, because the file format doesn't make * it possible. * - * \return - LZMA_OK + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * \param options Pointer to encoder options + * + * \return Possible lzma_ret values: + * - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_PROG_ERROR @@ -452,6 +486,11 @@ extern LZMA_API(lzma_ret) lzma_alone_encoder( * will) have larger maximum expansion when encoding * uncompressible data. Currently there is no function to * calculate the maximum expansion of multi-call encoding. + * + * \param uncompressed_size Size in bytes of the uncompressed + * input data + * + * \return Maximum number of bytes needed to store the compressed data. */ extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size) lzma_nothrow; @@ -460,22 +499,23 @@ extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size) /** * \brief Single-call .xz Stream encoder * - * \param filters Array of filters. This must be terminated with - * filters[n].id = LZMA_VLI_UNKNOWN. See filter.h - * for more information. + * \param filters Array of filters terminated with + * .id == LZMA_VLI_UNKNOWN. See filters.h for more + * information. * \param check Type of the integrity check to calculate from * uncompressed data. * \param allocator lzma_allocator for custom allocator functions. * Set to NULL to use malloc() and free(). * \param in Beginning of the input buffer * \param in_size Size of the input buffer - * \param out Beginning of the output buffer - * \param out_pos The next byte will be written to out[*out_pos]. + * \param[out] out Beginning of the output buffer + * \param[out] out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if encoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * - * \return - LZMA_OK: Encoding was successful. + * \return Possible lzma_ret values: + * - LZMA_OK: Encoding was successful. * - LZMA_BUF_ERROR: Not enough output buffer space. * - LZMA_UNSUPPORTED_CHECK * - LZMA_OPTIONS_ERROR @@ -531,7 +571,12 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode( * uses too where many small streams are needed. XZ Embedded includes a * decoder for this format. * - * \return - LZMA_STREAM_END: All good. Check the amounts of input used + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * \param options Pointer to encoder options + * + * \return Possible lzma_ret values: + * - LZMA_STREAM_END: All good. Check the amounts of input used * and output produced. Store the amount of input used * (uncompressed size) as it needs to be known to decompress * the data. @@ -648,7 +693,8 @@ extern LZMA_API(lzma_ret) lzma_microlzma_encoder( /** * \brief Initialize .xz Stream decoder * - * \param strm Pointer to properly prepared lzma_stream + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. * \param memlimit Memory usage limit as bytes. Use UINT64_MAX * to effectively disable the limiter. liblzma * 5.2.3 and earlier don't allow 0 here and return @@ -659,7 +705,8 @@ extern LZMA_API(lzma_ret) lzma_microlzma_encoder( * LZMA_TELL_ANY_CHECK, LZMA_IGNORE_CHECK, * LZMA_CONCATENATED, LZMA_FAIL_FAST * - * \return - LZMA_OK: Initialization was successful. + * \return Possible lzma_ret values: + * - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR: Cannot allocate memory. * - LZMA_OPTIONS_ERROR: Unsupported flags * - LZMA_PROG_ERROR @@ -672,9 +719,6 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder( /** * \brief Initialize multithreaded .xz Stream decoder * - * \param strm Pointer to properly prepared lzma_stream - * \param options Pointer to multithreaded compression options - * * The decoder can decode multiple Blocks in parallel. This requires that each * Block Header contains the Compressed Size and Uncompressed size fields * which are added by the multi-threaded encoder, see lzma_stream_encoder_mt(). @@ -688,7 +732,12 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder( * This function behaves like lzma_stream_decoder() when options->threads == 1 * and options->memlimit_threading <= 1. * - * \return - LZMA_OK: Initialization was successful. + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * \param options Pointer to multithreaded compression options + * + * \return Possible lzma_ret values: + * - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR: Cannot allocate memory. * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached. * - LZMA_OPTIONS_ERROR: Unsupported flags. @@ -715,7 +764,8 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder_mt( * as it doesn't support any decoder flags. It will return LZMA_STREAM_END * after one .lzma stream.) * - * \param strm Pointer to properly prepared lzma_stream + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. * \param memlimit Memory usage limit as bytes. Use UINT64_MAX * to effectively disable the limiter. liblzma * 5.2.3 and earlier don't allow 0 here and return @@ -726,7 +776,8 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder_mt( * LZMA_TELL_ANY_CHECK, LZMA_IGNORE_CHECK, * LZMA_CONCATENATED, LZMA_FAIL_FAST * - * \return - LZMA_OK: Initialization was successful. + * \return Possible lzma_ret values: + * - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR: Cannot allocate memory. * - LZMA_OPTIONS_ERROR: Unsupported flags * - LZMA_PROG_ERROR @@ -739,18 +790,20 @@ extern LZMA_API(lzma_ret) lzma_auto_decoder( /** * \brief Initialize .lzma decoder (legacy file format) * - * \param strm Pointer to properly prepared lzma_stream + * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH. + * There is no need to use LZMA_FINISH, but it's allowed because it may + * simplify certain types of applications. + * + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. * \param memlimit Memory usage limit as bytes. Use UINT64_MAX * to effectively disable the limiter. liblzma * 5.2.3 and earlier don't allow 0 here and return * LZMA_PROG_ERROR; later versions treat 0 as if 1 * had been specified. * - * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH. - * There is no need to use LZMA_FINISH, but it's allowed because it may - * simplify certain types of applications. - * - * \return - LZMA_OK + * \return Possible lzma_ret values: + * - LZMA_OK * - LZMA_MEM_ERROR * - LZMA_PROG_ERROR */ @@ -762,18 +815,6 @@ extern LZMA_API(lzma_ret) lzma_alone_decoder( /** * \brief Initialize .lz (lzip) decoder (a foreign file format) * - * \param strm Pointer to properly prepared lzma_stream - * \param memlimit Memory usage limit as bytes. Use UINT64_MAX - * to effectively disable the limiter. - * \param flags Bitwise-or of flags, or zero for no flags. - * All decoder flags listed above are supported - * although only LZMA_CONCATENATED and (in very rare - * cases) LZMA_IGNORE_CHECK are actually useful. - * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, - * and LZMA_FAIL_FAST do nothing. LZMA_TELL_ANY_CHECK - * is supported for consistency only as CRC32 is - * always used in the .lz format. - * * This decoder supports the .lz format version 0 and the unextended .lz * format version 1: * @@ -807,7 +848,21 @@ extern LZMA_API(lzma_ret) lzma_alone_decoder( * one should ensure that none of the first four bytes of trailing data are * equal to the magic bytes because lzip >= 1.20 requires it by default. * - * \return - LZMA_OK: Initialization was successful. + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. + * \param memlimit Memory usage limit as bytes. Use UINT64_MAX + * to effectively disable the limiter. + * \param flags Bitwise-or of flags, or zero for no flags. + * All decoder flags listed above are supported + * although only LZMA_CONCATENATED and (in very rare + * cases) LZMA_IGNORE_CHECK are actually useful. + * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, + * and LZMA_FAIL_FAST do nothing. LZMA_TELL_ANY_CHECK + * is supported for consistency only as CRC32 is + * always used in the .lz format. + * + * \return Possible lzma_ret values: + * - LZMA_OK: Initialization was successful. * - LZMA_MEM_ERROR: Cannot allocate memory. * - LZMA_OPTIONS_ERROR: Unsupported flags * - LZMA_PROG_ERROR @@ -836,13 +891,14 @@ extern LZMA_API(lzma_ret) lzma_lzip_decoder( * *in_pos is updated only if decoding succeeds. * \param in_size Size of the input buffer; the first byte that * won't be read is in[in_size]. - * \param out Beginning of the output buffer - * \param out_pos The next byte will be written to out[*out_pos]. + * \param[out] out Beginning of the output buffer + * \param[out] out_pos The next byte will be written to out[*out_pos]. * *out_pos is updated only if decoding succeeds. * \param out_size Size of the out buffer; the first byte into * which no data is written to is out[out_size]. * - * \return - LZMA_OK: Decoding was successful. + * \return Possible lzma_ret values: + * - LZMA_OK: Decoding was successful. * - LZMA_FORMAT_ERROR * - LZMA_OPTIONS_ERROR * - LZMA_DATA_ERROR @@ -867,12 +923,13 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode( /** * \brief MicroLZMA decoder * - * See lzma_microlzma_decoder() for more information. + * See lzma_microlzma_encoder() for more information. * * The lzma_code() usage with this decoder is completely normal. The * special behavior of lzma_code() applies to lzma_microlzma_encoder() only. * - * \param strm Pointer to properly prepared lzma_stream + * \param strm Pointer to lzma_stream that is at least initialized + * with LZMA_STREAM_INIT. * \param comp_size Compressed size of the MicroLZMA stream. * The caller must somehow know this exactly. * \param uncomp_size Uncompressed size of the MicroLZMA stream. @@ -897,6 +954,12 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode( * the implementation in XZ Embedded it doesn't * affect the memory usage if one specifies bigger * dictionary than actually required.) + * + * \return Possible lzma_ret values: + * - LZMA_OK + * - LZMA_MEM_ERROR + * - LZMA_OPTIONS_ERROR + * - LZMA_PROG_ERROR */ extern LZMA_API(lzma_ret) lzma_microlzma_decoder( lzma_stream *strm, uint64_t comp_size, |