From de678e0c924aa79a19293a8a6ed82e8cb6572a42 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 11 Apr 2011 22:03:30 +0300 Subject: 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. --- src/liblzma/common/common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/liblzma/common/common.c') 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) -- cgit v1.2.3