aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma_encoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-01-18 20:02:52 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-01-18 20:02:52 +0200
commitab5feaf1fcc146ef9fd39360c53c290bec39524e (patch)
treeb1521a6f12fd29f66c4c19edef88e0f4024e00ef /src/liblzma/lzma/lzma_encoder.c
parentDon't add -g to CFLAGS when --enable-debug is specified. (diff)
downloadxz-ab5feaf1fcc146ef9fd39360c53c290bec39524e.tar.xz
Fix LZMA_SYNC_FLUSH handling in LZ and LZMA encoders.
That code is now almost completely in LZ coder, where it can be shared with other LZ77-based algorithms in future.
Diffstat (limited to 'src/liblzma/lzma/lzma_encoder.c')
-rw-r--r--src/liblzma/lzma/lzma_encoder.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/liblzma/lzma/lzma_encoder.c b/src/liblzma/lzma/lzma_encoder.c
index 8a5b0142..0fcb755c 100644
--- a/src/liblzma/lzma/lzma_encoder.c
+++ b/src/liblzma/lzma/lzma_encoder.c
@@ -157,31 +157,8 @@ lzma_lzma_encode(lzma_coder *coder, uint8_t *restrict out,
// Initialize the stream if no data has been encoded yet.
if (!coder->is_initialized) {
if (coder->lz.read_pos == coder->lz.read_limit) {
- switch (coder->lz.sequence) {
- case SEQ_RUN:
- // Cannot initialize, because there is
- // no input data.
- return false;
-
- case SEQ_FLUSH:
- // Nothing to flush. There cannot be a flush
- // marker when no data has been processed
- // yet (file format doesn't allow it, and
- // it would be just waste of space).
- return true;
-
- case SEQ_FINISH:
- // We are encoding an empty file. No need
- // to initialize the encoder.
- assert(coder->lz.write_pos == coder->lz.read_pos);
- break;
-
- default:
- // We never get here.
- assert(0);
- return true;
- }
-
+ assert(coder->lz.write_pos == coder->lz.read_pos);
+ assert(coder->lz.sequence == SEQ_FINISH);
} else {
// Do the actual initialization.
uint32_t len;