aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/api
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2021-01-17 18:53:34 +0200
committerLasse Collin <lasse.collin@tukaani.org>2021-01-17 18:53:34 +0200
commit774cc0118ba2496581cb2621505a04bb6598cc75 (patch)
tree76d2253456c4cc51813623587cfa157a0cf84985 /src/liblzma/api
parentliblzma: Fix missing normalization in rc_encode_dummy(). (diff)
downloadxz-774cc0118ba2496581cb2621505a04bb6598cc75.tar.xz
liblzma: Make EROFS LZMA decoder work when exact uncomp_size isn't known.
The caller must still not specify an uncompressed size bigger than the actual uncompressed size. As a downside, this now needs the exact compressed size.
Diffstat (limited to 'src/liblzma/api')
-rw-r--r--src/liblzma/api/lzma/container.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/liblzma/api/lzma/container.h b/src/liblzma/api/lzma/container.h
index 581f3507..4ad7ce6a 100644
--- a/src/liblzma/api/lzma/container.h
+++ b/src/liblzma/api/lzma/container.h
@@ -690,11 +690,22 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
* The special behavior of lzma_code() applies to lzma_erofs_encoder() only.
*
* \param strm Pointer to properly prepared lzma_stream
+ * \param comp_size Compressed size of the EROFS LZMA stream.
+ * The caller must somehow know this exactly.
* \param uncomp_size Uncompressed size of the EROFS LZMA stream.
- * The caller must somehow know this. Note that
- * while the EROFS LZMA decoder in XZ Embedded needs
- * also the compressed size, the implementation in
- * liblzma doesn't need to know the compressed size.
+ * If the exact uncompressed size isn't known, this
+ * can be set to a value that is at most as big as
+ * the exact uncompressed size would be, but then the
+ * next argument uncomp_size_is_exact must be false.
+ * \param uncomp_size_is_exact
+ * If true, uncomp_size must be exactly correct.
+ * This will improve error detection at the end of
+ * the stream. If the exact uncompressed size isn't
+ * known, this must be false. uncomp_size must still
+ * be at most as big as the exact uncompressed size
+ * is. Setting this to false when the exact size is
+ * known will work but error detection at the end of
+ * the stream will be weaker.
* \param dict_size LZMA dictionary size that was used when
* compressing the data. It is OK to use a bigger
* value too but liblzma will then allocate more
@@ -705,4 +716,6 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
* dictionary than actually required.)
*/
extern LZMA_API(lzma_ret) lzma_erofs_decoder(
- lzma_stream *strm, uint64_t uncomp_size, uint32_t dict_size);
+ lzma_stream *strm, uint64_t comp_size,
+ uint64_t uncomp_size, lzma_bool uncomp_size_is_exact,
+ uint32_t dict_size);