| Index: src/liblzma/api/lzma/filter.h
|
| ===================================================================
|
| --- src/liblzma/api/lzma/filter.h (revision 50504)
|
| +++ src/liblzma/api/lzma/filter.h (working copy)
|
| @@ -1,6 +1,6 @@
|
| /**
|
| * \file lzma/filter.h
|
| - * \brief Common filter related types
|
| + * \brief Common filter related types and functions
|
| */
|
|
|
| /*
|
| @@ -59,11 +59,6 @@
|
| * If the filter doesn't need options, set this to NULL. If id is
|
| * set to LZMA_VLI_UNKNOWN, options is ignored, and thus
|
| * doesn't need be initialized.
|
| - *
|
| - * Some filters support changing the options in the middle of
|
| - * the encoding process. These filters store the pointer of the
|
| - * options structure and communicate with the application via
|
| - * modifications of the options structure.
|
| */
|
| void *options;
|
|
|
| @@ -126,32 +121,38 @@
|
|
|
|
|
| /**
|
| - * \brief Calculate rough memory requirements for raw encoder
|
| + * \brief Calculate approximate memory requirements for raw encoder
|
| *
|
| - * Because the calculation is rough, this function can be used to calculate
|
| - * the memory requirements for Block and Stream encoders too.
|
| + * This function can be used to calculate the memory requirements for
|
| + * Block and Stream encoders too because Block and Stream encoders don't
|
| + * need significantly more memory than raw encoder.
|
| *
|
| * \param filters Array of filters terminated with
|
| * .id == LZMA_VLI_UNKNOWN.
|
| *
|
| - * \return Rough number of bytes of memory required for the given
|
| - * filter chain when encoding.
|
| + * \return Number of bytes of memory required for the given
|
| + * filter chain when encoding. If an error occurs,
|
| + * for example due to unsupported filter chain,
|
| + * UINT64_MAX is returned.
|
| */
|
| extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters)
|
| lzma_nothrow lzma_attr_pure;
|
|
|
|
|
| /**
|
| - * \brief Calculate rough memory requirements for raw decoder
|
| + * \brief Calculate approximate memory requirements for raw decoder
|
| *
|
| - * Because the calculation is rough, this function can be used to calculate
|
| - * the memory requirements for Block and Stream decoders too.
|
| + * This function can be used to calculate the memory requirements for
|
| + * Block and Stream decoders too because Block and Stream decoders don't
|
| + * need significantly more memory than raw decoder.
|
| *
|
| * \param filters Array of filters terminated with
|
| * .id == LZMA_VLI_UNKNOWN.
|
| *
|
| - * \return Rough number of bytes of memory required for the given
|
| - * filter chain when decoding.
|
| + * \return Number of bytes of memory required for the given
|
| + * filter chain when decoding. If an error occurs,
|
| + * for example due to unsupported filter chain,
|
| + * UINT64_MAX is returned.
|
| */
|
| extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters)
|
| lzma_nothrow lzma_attr_pure;
|
| @@ -251,7 +252,8 @@
|
| *
|
| * \note There is no function to calculate how big output buffer
|
| * would surely be big enough. (lzma_stream_buffer_bound()
|
| - * works only for lzma_stream_buffer_encode().)
|
| + * works only for lzma_stream_buffer_encode(); raw encoder
|
| + * won't necessarily meet that bound.)
|
| */
|
| extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
|
| const lzma_filter *filters, lzma_allocator *allocator,
|
| @@ -323,9 +325,10 @@
|
| * succeeds but using the same options to initialize the encoder
|
| * will fail.
|
| *
|
| - * \note It is OK to skip calling this function if
|
| - * lzma_properties_size() indicated that the size
|
| - * of the Filter Properties field is zero.
|
| + * \note If lzma_properties_size() indicated that the size
|
| + * of the Filter Properties field is zero, calling
|
| + * lzma_properties_encode() is not required, but it
|
| + * won't do any harm either.
|
| */
|
| extern LZMA_API(lzma_ret) lzma_properties_encode(
|
| const lzma_filter *filter, uint8_t *props) lzma_nothrow;
|
| @@ -364,11 +367,11 @@
|
| * memory to hold the encoded Filter Flags.
|
| *
|
| * \param size Pointer to integer to hold the calculated size
|
| - * \param filters Filter ID and associated options whose encoded
|
| + * \param filter Filter ID and associated options whose encoded
|
| * size is to be calculated
|
| *
|
| * \return - LZMA_OK: *size set successfully. Note that this doesn't
|
| - * guarantee that filters->options is valid, thus
|
| + * guarantee that filter->options is valid, thus
|
| * lzma_filter_flags_encode() may still fail.
|
| * - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options.
|
| * - LZMA_PROG_ERROR: Invalid options
|
| @@ -377,7 +380,7 @@
|
| * you need to loop over every lzma_filter entry.
|
| */
|
| extern LZMA_API(lzma_ret) lzma_filter_flags_size(
|
| - uint32_t *size, const lzma_filter *filters)
|
| + uint32_t *size, const lzma_filter *filter)
|
| lzma_nothrow lzma_attr_warn_unused_result;
|
|
|
|
|
| @@ -387,7 +390,7 @@
|
| * In contrast to some functions, this doesn't allocate the needed buffer.
|
| * This is due to how this function is used internally by liblzma.
|
| *
|
| - * \param filters Filter ID and options to be encoded
|
| + * \param filter Filter ID and options to be encoded
|
| * \param out Beginning of the output buffer
|
| * \param out_pos out[*out_pos] is the next write position. This
|
| * is updated by the encoder.
|
| @@ -399,7 +402,7 @@
|
| * buffer space (you should have checked it with
|
| * lzma_filter_flags_size()).
|
| */
|
| -extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filters,
|
| +extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter,
|
| uint8_t *out, size_t *out_pos, size_t out_size)
|
| lzma_nothrow lzma_attr_warn_unused_result;
|
|
|
| @@ -407,8 +410,8 @@
|
| /**
|
| * \brief Decode Filter Flags from given buffer
|
| *
|
| - * The decoded result is stored into *filters. filters->options is
|
| - * initialized but the old value is NOT free()d.
|
| + * The decoded result is stored into *filter. The old value of
|
| + * filter->options is not free()d.
|
| *
|
| * \return - LZMA_OK
|
| * - LZMA_OPTIONS_ERROR
|
| @@ -416,6 +419,6 @@
|
| * - LZMA_PROG_ERROR
|
| */
|
| extern LZMA_API(lzma_ret) lzma_filter_flags_decode(
|
| - lzma_filter *filters, lzma_allocator *allocator,
|
| + lzma_filter *filter, lzma_allocator *allocator,
|
| const uint8_t *in, size_t *in_pos, size_t in_size)
|
| lzma_nothrow lzma_attr_warn_unused_result;
|
|
|