The documentation suggests that lzma_block_encoder supports LZMA_SYNC_FLUSH, but it was never added to the supported_actions internal struct. So, it was not possible to do LZMA_SYNC_FLUSH unless the block encoder was wrapped in an encoder that supported that action, such as the lzma_stream_encoder. Either this or the documentation needs to be changed.
This patch is a very simple one line change, but I tested it along with the rest of the block API functions. If anyone is interested in seeing my tests, they are available at https://github.com/JiaT75/XZ_Utils_Unofficial/tree/test_block_api. Jia Tan
From c0db5db334faa576d78a5b6c6980315b4c149da0 Mon Sep 17 00:00:00 2001 From: jiat75 <jiat0...@gmail.com> Date: Thu, 5 May 2022 20:53:42 +0800 Subject: [PATCH] Added support for LZMA_SYNC_FLUSH in the block encoder The documentation mentions that lzma_block_encoder supports LZMA_SYNC_FLUSH, but it was never added to the supported_actions internal structure. Because of this, LZMA_SYNC_FLUSH could not be used with the block encoder unless it was a next coder after something like the stream_encoder or stream_encoder_mt. --- src/liblzma/common/block_encoder.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/liblzma/common/block_encoder.c b/src/liblzma/common/block_encoder.c index 168846ad..f32696c2 100644 --- a/src/liblzma/common/block_encoder.c +++ b/src/liblzma/common/block_encoder.c @@ -218,6 +218,7 @@ lzma_block_encoder(lzma_stream *strm, lzma_block *block) strm->internal->supported_actions[LZMA_RUN] = true; strm->internal->supported_actions[LZMA_FINISH] = true; + strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true; return LZMA_OK; } -- 2.25.1