diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2022-04-02 21:49:59 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-04-02 21:49:59 +0300 |
commit | e671bc8828b9c0c5406c3a22c541301d0eb54518 (patch) | |
tree | 28b0fe159991cb45fdf98c9bb70cc86c2875f3a3 /src/xz/options.c | |
parent | Update THANKS. (diff) | |
download | xz-e671bc8828b9c0c5406c3a22c541301d0eb54518.tar.xz |
liblzma: Threaded decoder: Support zpipe.c-style decoding loop.
This makes it possible to call lzma_code() in a loop that only
reads new input when lzma_code() didn't fill the output buffer
completely. That isn't the calling style suggested by the
liblzma example program 02_decompress.c so perhaps the usefulness
of this feature is limited.
Also, it is possible to write such a loop so that it works
with the single-threaded decoder but not with the threaded
decoder even after this commit, or so that it works only if
lzma_mt.timeout = 0.
The zlib tutorial <https://zlib.net/zlib_how.html> is a well-known
example of a loop where more input is read only when output isn't
full. Porting this as is to liblzma would work with the
single-threaded decoder (if LZMA_CONCATENATED isn't used) but it
wouldn't work with threaded decoder even after this commit because
the loop assumes that no more output is possible when it cannot
read more input ("if (strm.avail_in == 0) break;"). This cannot
be fixed at liblzma side; the loop has to be modified at least
a little.
I'm adding this in any case because the actual code is simple
and short and should have no harmful side-effects in other
situations.
Diffstat (limited to 'src/xz/options.c')
0 files changed, 0 insertions, 0 deletions