summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog25
-rw-r--r--Makefile.in3
-rw-r--r--README4
-rw-r--r--arg_parser.cc4
-rwxr-xr-xconfigure2
-rw-r--r--decoder.cc28
-rw-r--r--doc/lzip.14
-rw-r--r--doc/lzip.info46
-rw-r--r--doc/lzip.texinfo34
-rw-r--r--encoder.cc23
-rw-r--r--encoder.h16
-rw-r--r--lzip.h11
-rw-r--r--main.cc10
13 files changed, 96 insertions, 114 deletions
diff --git a/ChangeLog b/ChangeLog
index edd72f5..94a8301 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,26 +1,11 @@
-2013-08-01 Antonio Diaz Diaz <antonio@gnu.org>
+2013-09-20 Antonio Diaz Diaz <antonio@gnu.org>
- * Version 1.15-rc1 released.
- * main.cc (show_header): Do not show header version.
- * Updated appendix 'Reference source code' to version 0.4 of lzd.
- * Minor fixes.
-
-2013-07-15 Antonio Diaz Diaz <antonio@gnu.org>
-
- * Version 1.15-pre3 released.
+ * Version 1.15 released.
* Show progress of compression at verbosity level 2 (-vv).
-
-2013-05-11 Antonio Diaz Diaz <antonio@gnu.org>
-
- * Version 1.15-pre2 released.
- * configure: Options now accept a separate argument.
-
-2013-03-21 Antonio Diaz Diaz <ant_diaz@teleline.es>
-
- * Version 1.15-pre1 released.
- * main.cc (show_header): Show header version if verbosity >= 4.
+ * main.cc (show_header): Do not show header version.
* Ignore option '-n, --threads' for compatibility with plzip.
- * Added chapter 'Stream Format' and appendix 'Reference source code'
+ * configure: Options now accept a separate argument.
+ * Added chapter 'Stream format' and appendix 'Reference source code'
to the manual.
2013-02-17 Antonio Diaz Diaz <ant_diaz@teleline.es>
diff --git a/Makefile.in b/Makefile.in
index f6daaa1..c8f0ad9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -45,8 +45,7 @@ $(VPATH)/doc/$(pkgname).info : $(VPATH)/doc/$(pkgname).texinfo
man : $(VPATH)/doc/$(progname).1
$(VPATH)/doc/$(progname).1 : $(progname)
- help2man -n 'reduces the size of files' \
- -o $@ ./$(progname)
+ help2man -n 'reduces the size of files' -o $@ ./$(progname)
Makefile : $(VPATH)/configure $(VPATH)/Makefile.in
./config.status
diff --git a/README b/README
index a47dd17..16a8151 100644
--- a/README
+++ b/README
@@ -26,8 +26,8 @@ recovery capabilities, including error-checked merging of damaged copies
of a file.
Lzip uses the same well-defined exit status values used by bzip2, which
-makes it safer when used in pipes or scripts than compressors returning
-ambiguous warning values, like gzip.
+makes it safer than compressors returning ambiguous warning values (like
+gzip) when it is used as a back end for tar or zutils.
Lzip replaces every file given in the command line with a compressed
version of itself, with the name "original_name.lz". Each compressed
diff --git a/arg_parser.cc b/arg_parser.cc
index a28d2ba..5cb98a9 100644
--- a/arg_parser.cc
+++ b/arg_parser.cc
@@ -156,12 +156,12 @@ Arg_parser::Arg_parser( const int argc, const char * const argv[],
while( argind < argc )
{
const unsigned char ch1 = argv[argind][0];
- const unsigned char ch2 = ( ch1 ? argv[argind][1] : 0 );
+ const unsigned char ch2 = ch1 ? argv[argind][1] : 0;
if( ch1 == '-' && ch2 ) // we found an option
{
const char * const opt = argv[argind];
- const char * const arg = (argind + 1 < argc) ? argv[argind+1] : 0;
+ const char * const arg = ( argind + 1 < argc ) ? argv[argind+1] : 0;
if( ch2 == '-' )
{
if( !argv[argind][2] ) { ++argind; break; } // we found "--"
diff --git a/configure b/configure
index ae61b04..20a11a2 100755
--- a/configure
+++ b/configure
@@ -6,7 +6,7 @@
# to copy, distribute and modify it.
pkgname=lzip
-pkgversion=1.15-rc1
+pkgversion=1.15
progname=lzip
srctrigger=doc/${pkgname}.texinfo
diff --git a/decoder.cc b/decoder.cc
index b23daa2..06d334b 100644
--- a/decoder.cc
+++ b/decoder.cc
@@ -51,9 +51,9 @@ void Pretty_print::operator()( const char * const msg ) const
}
-// Returns the number of bytes really read.
-// If (returned value < size) and (errno == 0), means EOF was reached.
-//
+/* Returns the number of bytes really read.
+ If (returned value < size) and (errno == 0), means EOF was reached.
+*/
int readblock( const int fd, uint8_t * const buf, const int size )
{
int rest = size;
@@ -70,9 +70,9 @@ int readblock( const int fd, uint8_t * const buf, const int size )
}
-// Returns the number of bytes really written.
-// If (returned value < size), it is always an error.
-//
+/* Returns the number of bytes really written.
+ If (returned value < size), it is always an error.
+*/
int writeblock( const int fd, const uint8_t * const buf, const int size )
{
int rest = size;
@@ -104,9 +104,9 @@ bool Range_decoder::read_block()
void LZ_decoder::flush_data()
{
- const int size = pos - stream_pos;
- if( size > 0 )
+ if( pos > stream_pos )
{
+ const int size = pos - stream_pos;
crc32.update_buf( crc_, buffer + stream_pos, size );
if( outfd >= 0 &&
writeblock( outfd, buffer + stream_pos, size ) != size )
@@ -187,8 +187,8 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const
}
-// Return value: 0 = OK, 1 = decoder error, 2 = unexpected EOF,
-// 3 = trailer error, 4 = unknown marker found.
+/* Return value: 0 = OK, 1 = decoder error, 2 = unexpected EOF,
+ 3 = trailer error, 4 = unknown marker found. */
int LZ_decoder::decode_member( const Pretty_print & pp )
{
Bit_model bm_literal[1<<literal_context_bits][0x300];
@@ -198,7 +198,7 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
Bit_model bm_rep1[State::states];
Bit_model bm_rep2[State::states];
Bit_model bm_len[State::states][pos_states];
- Bit_model bm_dis_slot[max_dis_states][1<<dis_slot_bits];
+ Bit_model bm_dis_slot[len_states][1<<dis_slot_bits];
Bit_model bm_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size];
Len_model match_len_model;
@@ -231,9 +231,9 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
else
{
int len;
- if( rdec.decode_bit( bm_rep[state()] ) == 1 ) // 2nd bit
+ if( rdec.decode_bit( bm_rep[state()] ) != 0 ) // 2nd bit
{
- if( rdec.decode_bit( bm_rep0[state()] ) == 1 ) // 3rd bit
+ if( rdec.decode_bit( bm_rep0[state()] ) != 0 ) // 3rd bit
{
unsigned distance;
if( rdec.decode_bit( bm_rep1[state()] ) == 0 ) // 4th bit
@@ -261,7 +261,7 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
{
const unsigned rep0_saved = rep0;
len = min_match_len + rdec.decode_len( match_len_model, pos_state );
- const int dis_slot = rdec.decode_tree6( bm_dis_slot[get_dis_state(len)] );
+ const int dis_slot = rdec.decode_tree6( bm_dis_slot[get_len_state(len)] );
if( dis_slot < start_dis_model ) rep0 = dis_slot;
else
{
diff --git a/doc/lzip.1 b/doc/lzip.1
index 14654c2..a2677d0 100644
--- a/doc/lzip.1
+++ b/doc/lzip.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
-.TH LZIP "1" "August 2013" "Lzip 1.15-rc1" "User Commands"
+.TH LZIP "1" "September 2013" "Lzip 1.15" "User Commands"
.SH NAME
Lzip \- reduces the size of files
.SH SYNOPSIS
@@ -43,7 +43,7 @@ if reading stdin, place the output into <file>
suppress all messages
.TP
\fB\-s\fR, \fB\-\-dictionary\-size=\fR<bytes>
-set dictionary size limit in bytes [8MiB]
+set dictionary size limit in bytes [8 MiB]
.TP
\fB\-S\fR, \fB\-\-volume\-size=\fR<bytes>
set volume size limit in bytes
diff --git a/doc/lzip.info b/doc/lzip.info
index 4445d40..a1a2cbe 100644
--- a/doc/lzip.info
+++ b/doc/lzip.info
@@ -11,7 +11,7 @@ File: lzip.info, Node: Top, Next: Introduction, Up: (dir)
Lzip Manual
***********
-This manual is for Lzip (version 1.15-rc1, 1 August 2013).
+This manual is for Lzip (version 1.15, 20 September 2013).
* Menu:
@@ -63,8 +63,8 @@ recovery capabilities, including error-checked merging of damaged copies
of a file.
Lzip uses the same well-defined exit status values used by bzip2,
-which makes it safer when used in pipes or scripts than compressors
-returning ambiguous warning values, like gzip.
+which makes it safer than compressors returning ambiguous warning
+values (like gzip) when it is used as a back end for tar or zutils.
Lzip replaces every file given in the command line with a compressed
version of itself, with the name "original_name.lz". Each compressed
@@ -278,7 +278,7 @@ The format for running lzip is:
`--verbose'
Verbose mode.
When compressing, show the compression ratio for each file
- processed. A second -v shows the progress of compression.
+ processed. A second `-v' shows the progress of compression.
When decompressing or testing, further -v's (up to 4) increase the
verbosity level, showing status, compression ratio, dictionary
size, trailer contents (CRC, data size, member size), and up to 6
@@ -520,8 +520,8 @@ integers representing the probability of the corresponding bit being 0.
`literal_state'
Value of the 3 most significant bits of the latest byte decoded.
-`dis_state'
- Coded value of length (real length - 2), with a maximum of 3. The
+`len_state'
+ Coded value of length (length - 2), with a maximum of 3. The
resulting value is in the range 0 to 3.
@@ -561,7 +561,7 @@ bm_len state, pos_state after sequence 110
Name Indices Used when
---------------------------------------------------------------------------
-bm_dis_slot dis_state, bit tree distance start
+bm_dis_slot len_state, bit tree distance start
bm_dis reverse bit tree after slots 4 to 13
bm_align reverse bit tree for distances >= 128, after
fixed probability bits
@@ -696,7 +696,7 @@ file with a member size of 32 MiB.

File: lzip.info, Node: Problems, Next: Reference source code, Prev: Examples, Up: Top
-7 Reporting Bugs
+7 Reporting bugs
****************
There are probably bugs in lzip. There are certainly errors and
@@ -768,6 +768,7 @@ enum {
pos_states = 1 << pos_state_bits,
pos_state_mask = pos_states - 1,
+ len_states = 4,
dis_slot_bits = 6,
start_dis_model = 4,
end_dis_model = 14,
@@ -784,7 +785,6 @@ enum {
max_len_symbols = len_low_symbols + len_mid_symbols + len_high_symbols,
min_match_len = 2, // must be 2
- max_dis_states = 4,
bit_model_move_bits = 5,
bit_model_total_bits = 11,
@@ -1011,7 +1011,7 @@ bool LZ_decoder::decode_member() // Returns false if error
Bit_model bm_rep1[State::states];
Bit_model bm_rep2[State::states];
Bit_model bm_len[State::states][pos_states];
- Bit_model bm_dis_slot[max_dis_states][1<<dis_slot_bits];
+ Bit_model bm_dis_slot[len_states][1<<dis_slot_bits];
Bit_model bm_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size];
Len_model match_len_model;
@@ -1039,9 +1039,9 @@ bool LZ_decoder::decode_member() // Returns false if error
else
{
int len;
- if( rdec.decode_bit( bm_rep[state()] ) == 1 ) // 2nd bit
+ if( rdec.decode_bit( bm_rep[state()] ) != 0 ) // 2nd bit
{
- if( rdec.decode_bit( bm_rep0[state()] ) == 1 ) // 3rd bit
+ if( rdec.decode_bit( bm_rep0[state()] ) != 0 ) // 3rd bit
{
unsigned distance;
if( rdec.decode_bit( bm_rep1[state()] ) == 0 ) // 4th bit
@@ -1062,16 +1062,16 @@ bool LZ_decoder::decode_member() // Returns false if error
if( rdec.decode_bit( bm_len[state()][pos_state] ) == 0 ) // 4th bit
{ state.set_short_rep(); put_byte( get_byte( rep0 ) ); continue; }
}
- len = min_match_len + rdec.decode_len( rep_len_model, pos_state );
state.set_rep();
+ len = min_match_len + rdec.decode_len( rep_len_model, pos_state );
}
else
{
rep3 = rep2; rep2 = rep1; rep1 = rep0;
len = min_match_len + rdec.decode_len( match_len_model, pos_state );
- const int dis_state = std::min( len - min_match_len, max_dis_states - 1 );
+ const int len_state = std::min( len - min_match_len, len_states - 1 );
const int dis_slot =
- rdec.decode_tree( bm_dis_slot[dis_state], dis_slot_bits );
+ rdec.decode_tree( bm_dis_slot[len_state], dis_slot_bits );
if( dis_slot < start_dis_model ) rep0 = dis_slot;
else
{
@@ -1193,14 +1193,14 @@ Concept index
Tag Table:
Node: Top210
Node: Introduction1052
-Node: Algorithm5012
-Node: Invoking lzip7505
-Node: File format13181
-Node: Stream format15729
-Node: Examples25134
-Node: Problems27090
-Node: Reference source code27620
-Node: Concept index41135
+Node: Algorithm5031
+Node: Invoking lzip7524
+Node: File format13202
+Node: Stream format15750
+Node: Examples25150
+Node: Problems27106
+Node: Reference source code27636
+Node: Concept index41139

End Tag Table
diff --git a/doc/lzip.texinfo b/doc/lzip.texinfo
index 0e8ac92..cfc9138 100644
--- a/doc/lzip.texinfo
+++ b/doc/lzip.texinfo
@@ -6,8 +6,8 @@
@finalout
@c %**end of header
-@set UPDATED 1 August 2013
-@set VERSION 1.15-rc1
+@set UPDATED 20 September 2013
+@set VERSION 1.15
@dircategory Data Compression
@direntry
@@ -84,8 +84,8 @@ recovery capabilities, including error-checked merging of damaged copies
of a file.
Lzip uses the same well-defined exit status values used by bzip2, which
-makes it safer when used in pipes or scripts than compressors returning
-ambiguous warning values, like gzip.
+makes it safer than compressors returning ambiguous warning values (like
+gzip) when it is used as a back end for tar or zutils.
Lzip replaces every file given in the command line with a compressed
version of itself, with the name "original_name.lz". Each compressed
@@ -300,7 +300,7 @@ Use it together with @samp{-v} to see information about the file.
@itemx --verbose
Verbose mode.@*
When compressing, show the compression ratio for each file processed. A
-second -v shows the progress of compression.@*
+second @samp{-v} shows the progress of compression.@*
When decompressing or testing, further -v's (up to 4) increase the
verbosity level, showing status, compression ratio, dictionary size,
trailer contents (CRC, data size, member size), and up to 6 bytes of
@@ -554,9 +554,9 @@ decoded data.
@item literal_state
Value of the 3 most significant bits of the latest byte decoded.
-@item dis_state
-Coded value of length (real length - 2), with a maximum of 3. The
-resulting value is in the range 0 to 3.
+@item len_state
+Coded value of length (length - 2), with a maximum of 3. The resulting
+value is in the range 0 to 3.
@end table
@@ -600,7 +600,7 @@ The contexts for decoding distances are:
@multitable @columnfractions .2 .4 .4
@headitem Name @tab Indices @tab Used when
-@item bm_dis_slot @tab dis_state, bit tree @tab distance start
+@item bm_dis_slot @tab len_state, bit tree @tab distance start
@item bm_dis @tab reverse bit tree @tab after slots 4 to 13
@item bm_align @tab reverse bit tree @tab for distances >= 128, after
fixed probability bits
@@ -765,7 +765,7 @@ lzip -b 32MiB -S 650MB big_db
@node Problems
-@chapter Reporting Bugs
+@chapter Reporting bugs
@cindex bugs
@cindex getting help
@@ -838,6 +838,7 @@ enum {
pos_states = 1 << pos_state_bits,
pos_state_mask = pos_states - 1,
+ len_states = 4,
dis_slot_bits = 6,
start_dis_model = 4,
end_dis_model = 14,
@@ -854,7 +855,6 @@ enum {
max_len_symbols = len_low_symbols + len_mid_symbols + len_high_symbols,
min_match_len = 2, // must be 2
- max_dis_states = 4,
bit_model_move_bits = 5,
bit_model_total_bits = 11,
@@ -1081,7 +1081,7 @@ bool LZ_decoder::decode_member() // Returns false if error
Bit_model bm_rep1[State::states];
Bit_model bm_rep2[State::states];
Bit_model bm_len[State::states][pos_states];
- Bit_model bm_dis_slot[max_dis_states][1<<dis_slot_bits];
+ Bit_model bm_dis_slot[len_states][1<<dis_slot_bits];
Bit_model bm_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size];
Len_model match_len_model;
@@ -1109,9 +1109,9 @@ bool LZ_decoder::decode_member() // Returns false if error
else
{
int len;
- if( rdec.decode_bit( bm_rep[state()] ) == 1 ) // 2nd bit
+ if( rdec.decode_bit( bm_rep[state()] ) != 0 ) // 2nd bit
{
- if( rdec.decode_bit( bm_rep0[state()] ) == 1 ) // 3rd bit
+ if( rdec.decode_bit( bm_rep0[state()] ) != 0 ) // 3rd bit
{
unsigned distance;
if( rdec.decode_bit( bm_rep1[state()] ) == 0 ) // 4th bit
@@ -1132,16 +1132,16 @@ bool LZ_decoder::decode_member() // Returns false if error
if( rdec.decode_bit( bm_len[state()][pos_state] ) == 0 ) // 4th bit
{ state.set_short_rep(); put_byte( get_byte( rep0 ) ); continue; }
}
- len = min_match_len + rdec.decode_len( rep_len_model, pos_state );
state.set_rep();
+ len = min_match_len + rdec.decode_len( rep_len_model, pos_state );
}
else
{
rep3 = rep2; rep2 = rep1; rep1 = rep0;
len = min_match_len + rdec.decode_len( match_len_model, pos_state );
- const int dis_state = std::min( len - min_match_len, max_dis_states - 1 );
+ const int len_state = std::min( len - min_match_len, len_states - 1 );
const int dis_slot =
- rdec.decode_tree( bm_dis_slot[dis_state], dis_slot_bits );
+ rdec.decode_tree( bm_dis_slot[len_state], dis_slot_bits );
if( dis_slot < start_dis_model ) rep0 = dis_slot;
else
{
diff --git a/encoder.cc b/encoder.cc
index cc43337..563fd64 100644
--- a/encoder.cc
+++ b/encoder.cc
@@ -141,8 +141,7 @@ int Matchfinder::get_match_pairs( struct Pair * pairs )
int maxlen = min_match_len - 1;
int num_pairs = 0;
- const int min_pos = (pos > dictionary_size_) ?
- pos - dictionary_size_ : 0;
+ const int min_pos = ( pos > dictionary_size_ ) ? pos - dictionary_size_ : 0;
const uint8_t * const data = buffer + pos;
unsigned tmp = crc32[data[0]] ^ data[1];
@@ -310,14 +309,14 @@ void LZ_encoder::fill_distance_prices()
const int base = ( 2 | ( dis_slot & 1 ) ) << direct_bits;
const int price = price_symbol_reversed( bm_dis + base - dis_slot - 1,
dis - base, direct_bits );
- for( int dis_state = 0; dis_state < max_dis_states; ++dis_state )
- dis_prices[dis_state][dis] = price;
+ for( int len_state = 0; len_state < len_states; ++len_state )
+ dis_prices[len_state][dis] = price;
}
- for( int dis_state = 0; dis_state < max_dis_states; ++dis_state )
+ for( int len_state = 0; len_state < len_states; ++len_state )
{
- int * const dsp = dis_slot_prices[dis_state];
- const Bit_model * const bmds = bm_dis_slot[dis_state];
+ int * const dsp = dis_slot_prices[len_state];
+ const Bit_model * const bmds = bm_dis_slot[len_state];
int slot = 0;
for( ; slot < end_dis_model && slot < num_dis_slots; ++slot )
dsp[slot] = price_symbol( bmds, slot, dis_slot_bits );
@@ -325,7 +324,7 @@ void LZ_encoder::fill_distance_prices()
dsp[slot] = price_symbol( bmds, slot, dis_slot_bits ) +
(((( slot >> 1 ) - 1 ) - dis_align_bits ) << price_shift_bits );
- int * const dp = dis_prices[dis_state];
+ int * const dp = dis_prices[len_state];
int dis = 0;
for( ; dis < start_dis_model; ++dis )
dp[dis] = dsp[dis];
@@ -335,10 +334,10 @@ void LZ_encoder::fill_distance_prices()
}
-// Return value == number of bytes advanced (ahead).
-// trials[0]..trials[ahead-1] contain the steps to encode.
-// ( trials[0].dis == -1 && trials[0].price == 1 ) means literal.
-//
+/* Return value == number of bytes advanced (ahead).
+ trials[0]..trials[ahead-1] contain the steps to encode.
+ ( trials[0].dis == -1 && trials[0].price == 1 ) means literal.
+*/
int LZ_encoder::sequence_optimizer( const int reps[num_rep_distances],
const State state )
{
diff --git a/encoder.h b/encoder.h
index 577ceeb..725d0e8 100644
--- a/encoder.h
+++ b/encoder.h
@@ -427,7 +427,7 @@ protected:
Bit_model bm_rep1[State::states];
Bit_model bm_rep2[State::states];
Bit_model bm_len[State::states][pos_states];
- Bit_model bm_dis_slot[max_dis_states][1<<dis_slot_bits];
+ Bit_model bm_dis_slot[len_states][1<<dis_slot_bits];
Bit_model bm_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size];
@@ -488,7 +488,7 @@ protected:
{
match_len_encoder.encode( renc, len, pos_state );
const int dis_slot = get_slot( dis );
- renc.encode_tree( bm_dis_slot[get_dis_state(len)], dis_slot, dis_slot_bits );
+ renc.encode_tree( bm_dis_slot[get_len_state(len)], dis_slot, dis_slot_bits );
if( dis_slot >= start_dis_model )
{
@@ -560,8 +560,8 @@ class LZ_encoder : public LZ_encoder_base
struct Pair pairs[max_match_len+1];
Trial trials[max_num_trials];
- int dis_slot_prices[max_dis_states][2*max_dictionary_bits];
- int dis_prices[max_dis_states][modeled_distances];
+ int dis_slot_prices[len_states][2*max_dictionary_bits];
+ int dis_prices[len_states][modeled_distances];
int align_prices[dis_align_size];
int align_price_count;
@@ -594,19 +594,19 @@ class LZ_encoder : public LZ_encoder_base
rep_len_encoder.price( len, pos_state );
}
- int price_dis( const int dis, const int dis_state ) const
+ int price_dis( const int dis, const int len_state ) const
{
if( dis < modeled_distances )
- return dis_prices[dis_state][dis];
+ return dis_prices[len_state][dis];
else
- return dis_slot_prices[dis_state][get_slot( dis )] +
+ return dis_slot_prices[len_state][get_slot( dis )] +
align_prices[dis & (dis_align_size - 1)];
}
int price_pair( const int dis, const int len, const int pos_state ) const
{
return match_len_encoder.price( len, pos_state ) +
- price_dis( dis, get_dis_state( len ) );
+ price_dis( dis, get_len_state( len ) );
}
int read_match_distances()
diff --git a/lzip.h b/lzip.h
index b563833..b4b51e2 100644
--- a/lzip.h
+++ b/lzip.h
@@ -48,6 +48,7 @@ enum {
pos_states = 1 << pos_state_bits,
pos_state_mask = pos_states - 1,
+ len_states = 4,
dis_slot_bits = 6,
start_dis_model = 4,
end_dis_model = 14,
@@ -65,12 +66,10 @@ enum {
min_match_len = 2, // must be 2
max_match_len = min_match_len + max_len_symbols - 1, // 273
- min_match_len_limit = 5,
+ min_match_len_limit = 5 };
- max_dis_states = 4 };
-
-inline int get_dis_state( const int len )
- { return std::min( len - min_match_len, max_dis_states - 1 ); }
+inline int get_len_state( const int len )
+ { return std::min( len - min_match_len, len_states - 1 ); }
inline int get_lit_state( const uint8_t prev_byte )
{ return ( prev_byte >> ( 8 - literal_context_bits ) ); }
@@ -111,7 +110,7 @@ public:
for( unsigned i = 0; i < filenames.size(); ++i )
{
const std::string & s = filenames[i];
- const unsigned len = ( ( s == "-" ) ? stdin_name_len : s.size() );
+ const unsigned len = ( s == "-" ) ? stdin_name_len : s.size();
if( len > longest_name ) longest_name = len;
}
if( longest_name == 0 ) longest_name = stdin_name_len;
diff --git a/main.cc b/main.cc
index bd5c8c9..eaa93fd 100644
--- a/main.cc
+++ b/main.cc
@@ -84,8 +84,8 @@ struct { const char * from; const char * to; } const known_extensions[] = {
struct Lzma_options
{
- int dictionary_size; // 4KiB..512MiB
- int match_len_limit; // 5..273
+ int dictionary_size; // 4 KiB .. 512 MiB
+ int match_len_limit; // 5 .. 273
};
enum Mode { m_compress, m_decompress, m_test };
@@ -114,7 +114,7 @@ void show_help()
" -m, --match-length=<bytes> set match length limit in bytes [36]\n"
" -o, --output=<file> if reading stdin, place the output into <file>\n"
" -q, --quiet suppress all messages\n"
- " -s, --dictionary-size=<bytes> set dictionary size limit in bytes [8MiB]\n"
+ " -s, --dictionary-size=<bytes> set dictionary size limit in bytes [8 MiB]\n"
" -S, --volume-size=<bytes> set volume size limit in bytes\n"
" -t, --test test compressed file integrity\n"
" -v, --verbose be verbose (a 2nd -v gives more)\n"
@@ -739,8 +739,8 @@ void show_progress( const unsigned long long partial_size,
int main( const int argc, const char * const argv[] )
{
- // Mapping from gzip/bzip2 style 1..9 compression modes
- // to the corresponding LZMA compression modes.
+ /* Mapping from gzip/bzip2 style 1..9 compression modes
+ to the corresponding LZMA compression modes. */
const Lzma_options option_mapping[] =
{
{ 1 << 16, 16 }, // -0 entry values not used