aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/index_encoder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-11-19 20:46:52 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-11-19 20:46:52 +0200
commite114502b2bc371e4a45449832cb69be036360722 (patch)
tree449c41d0408f99926de202611091747f1fbe2f85 /src/liblzma/common/index_encoder.c
parentFixed the test that should have been fixed as part (diff)
downloadxz-e114502b2bc371e4a45449832cb69be036360722.tar.xz
Oh well, big messy commit again. Some highlights:
- Updated to the latest, probably final file format version. - Command line tool reworked to not use threads anymore. Threading will probably go into liblzma anyway. - Memory usage limit is now about 30 % for uncompression and about 90 % for compression. - Progress indicator with --verbose - Simplified --help and full --long-help - Upgraded to the last LGPLv2.1+ getopt_long from gnulib. - Some bug fixes
Diffstat (limited to '')
-rw-r--r--src/liblzma/common/index_encoder.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/liblzma/common/index_encoder.c b/src/liblzma/common/index_encoder.c
index 3005f835..522dbb53 100644
--- a/src/liblzma/common/index_encoder.c
+++ b/src/liblzma/common/index_encoder.c
@@ -26,7 +26,7 @@ struct lzma_coder_s {
enum {
SEQ_INDICATOR,
SEQ_COUNT,
- SEQ_TOTAL,
+ SEQ_UNPADDED,
SEQ_UNCOMPRESSED,
SEQ_NEXT,
SEQ_PADDING,
@@ -97,18 +97,20 @@ index_encode(lzma_coder *coder,
break;
}
- // Total Size must be a multiple of four.
- if (coder->record.total_size & 3)
+ // Unpadded Size must be within valid limits.
+ if (coder->record.unpadded_size < UNPADDED_SIZE_MIN
+ || coder->record.unpadded_size
+ > UNPADDED_SIZE_MAX)
return LZMA_PROG_ERROR;
- coder->sequence = SEQ_TOTAL;
+ coder->sequence = SEQ_UNPADDED;
// Fall through
- case SEQ_TOTAL:
+ case SEQ_UNPADDED:
case SEQ_UNCOMPRESSED: {
- const lzma_vli size = coder->sequence == SEQ_TOTAL
- ? total_size_encode(coder->record.total_size)
+ const lzma_vli size = coder->sequence == SEQ_UNPADDED
+ ? coder->record.unpadded_size
: coder->record.uncompressed_size;
ret = lzma_vli_encode(size, &coder->pos,