aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2017-03-30 20:00:09 +0300
committerLasse Collin <lasse.collin@tukaani.org>2017-03-30 20:00:09 +0300
commita27920002dbc469f778a134fc665b7c3ea73701b (patch)
treee2b222f24d57e10d562e98f45dbd08f41bc30077 /src/liblzma/common
parentliblzma: Fix lzma_memlimit_set(strm, 0). (diff)
downloadxz-a27920002dbc469f778a134fc665b7c3ea73701b.tar.xz
liblzma: Add generic support for input seeking (LZMA_SEEK).
Also mention LZMA_SEEK in xz/message.c to silence a warning.
Diffstat (limited to 'src/liblzma/common')
-rw-r--r--src/liblzma/common/common.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/liblzma/common/common.c b/src/liblzma/common/common.c
index 57e3f8eb..8ffe9764 100644
--- a/src/liblzma/common/common.c
+++ b/src/liblzma/common/common.c
@@ -207,7 +207,6 @@ lzma_code(lzma_stream *strm, lzma_action action)
|| strm->reserved_ptr2 != NULL
|| strm->reserved_ptr3 != NULL
|| strm->reserved_ptr4 != NULL
- || strm->reserved_int1 != 0
|| strm->reserved_int2 != 0
|| strm->reserved_int3 != 0
|| strm->reserved_int4 != 0
@@ -318,6 +317,17 @@ lzma_code(lzma_stream *strm, lzma_action action)
ret = LZMA_OK;
break;
+ case LZMA_SEEK:
+ strm->internal->allow_buf_error = false;
+
+ // If LZMA_FINISH was used, reset it back to the
+ // LZMA_RUN-based state so that new input can be supplied
+ // by the application.
+ if (strm->internal->sequence == ISEQ_FINISH)
+ strm->internal->sequence = ISEQ_RUN;
+
+ break;
+
case LZMA_STREAM_END:
if (strm->internal->sequence == ISEQ_SYNC_FLUSH
|| strm->internal->sequence == ISEQ_FULL_FLUSH