aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/common.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2013-10-02 12:55:11 +0300
committerLasse Collin <lasse.collin@tukaani.org>2013-10-02 12:55:11 +0300
commit97bb38712f414fabecca908af2e38a12570293fd (patch)
treecc16ca60363416ceacb18d955bae9105f3b0a8ee /src/liblzma/common/common.c
parentliblzma: Add block_buffer_encoder.h into Makefile.inc. (diff)
downloadxz-97bb38712f414fabecca908af2e38a12570293fd.tar.xz
liblzma: Add LZMA_FULL_BARRIER support to single-threaded encoder.
In the single-threaded encoder LZMA_FULL_BARRIER is simply an alias for LZMA_FULL_FLUSH.
Diffstat (limited to 'src/liblzma/common/common.c')
-rw-r--r--src/liblzma/common/common.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/liblzma/common/common.c b/src/liblzma/common/common.c
index 578d257a..efe6c226 100644
--- a/src/liblzma/common/common.c
+++ b/src/liblzma/common/common.c
@@ -176,7 +176,7 @@ lzma_code(lzma_stream *strm, lzma_action action)
|| (strm->next_out == NULL && strm->avail_out != 0)
|| strm->internal == NULL
|| strm->internal->next.code == NULL
- || (unsigned int)(action) > LZMA_FINISH
+ || (unsigned int)(action) > LZMA_ACTION_MAX
|| !strm->internal->supported_actions[action])
return LZMA_PROG_ERROR;
@@ -211,6 +211,10 @@ lzma_code(lzma_stream *strm, lzma_action action)
case LZMA_FINISH:
strm->internal->sequence = ISEQ_FINISH;
break;
+
+ case LZMA_FULL_BARRIER:
+ strm->internal->sequence = ISEQ_FULL_BARRIER;
+ break;
}
break;
@@ -238,6 +242,13 @@ lzma_code(lzma_stream *strm, lzma_action action)
break;
+ case ISEQ_FULL_BARRIER:
+ if (action != LZMA_FULL_BARRIER
+ || strm->internal->avail_in != strm->avail_in)
+ return LZMA_PROG_ERROR;
+
+ break;
+
case ISEQ_END:
return LZMA_STREAM_END;
@@ -288,7 +299,9 @@ lzma_code(lzma_stream *strm, lzma_action action)
case LZMA_STREAM_END:
if (strm->internal->sequence == ISEQ_SYNC_FLUSH
- || strm->internal->sequence == ISEQ_FULL_FLUSH)
+ || strm->internal->sequence == ISEQ_FULL_FLUSH
+ || strm->internal->sequence
+ == ISEQ_FULL_BARRIER)
strm->internal->sequence = ISEQ_RUN;
else
strm->internal->sequence = ISEQ_END;