aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/common.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2011-04-11 22:03:30 +0300
committerLasse Collin <lasse.collin@tukaani.org>2011-04-11 22:03:30 +0300
commitde678e0c924aa79a19293a8a6ed82e8cb6572a42 (patch)
tree43c9ca50d190794bd3ed99430c63c3784afbe22f /src/liblzma/common/common.c
parentliblzma: Add the forgotten lzma_lzma2_block_size(). (diff)
downloadxz-de678e0c924aa79a19293a8a6ed82e8cb6572a42.tar.xz
liblzma: Add lzma_stream_encoder_mt() for threaded compression.
This is the simplest method to do threading, which splits the uncompressed data into blocks and compresses them independently from each other. There's room for improvement especially to reduce the memory usage, but nevertheless, this is a good start.
Diffstat (limited to 'src/liblzma/common/common.c')
-rw-r--r--src/liblzma/common/common.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/liblzma/common/common.c b/src/liblzma/common/common.c
index 3005cca9..6afb4fbf 100644
--- a/src/liblzma/common/common.c
+++ b/src/liblzma/common/common.c
@@ -263,7 +263,9 @@ lzma_code(lzma_stream *strm, lzma_action action)
strm->internal->avail_in = strm->avail_in;
- switch (ret) {
+ // Cast is needed to silence a warning about LZMA_TIMED_OUT, which
+ // isn't part of lzma_ret enumeration.
+ switch ((unsigned int)(ret)) {
case LZMA_OK:
// Don't return LZMA_BUF_ERROR when it happens the first time.
// This is to avoid returning LZMA_BUF_ERROR when avail_out
@@ -279,6 +281,11 @@ lzma_code(lzma_stream *strm, lzma_action action)
}
break;
+ case LZMA_TIMED_OUT:
+ strm->internal->allow_buf_error = false;
+ ret = LZMA_OK;
+ break;
+
case LZMA_STREAM_END:
if (strm->internal->sequence == ISEQ_SYNC_FLUSH
|| strm->internal->sequence == ISEQ_FULL_FLUSH)