diff options
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Makefile.in | 3 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | carg_parser.c | 6 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | decoder.c | 14 | ||||
-rw-r--r-- | decoder.h | 4 | ||||
-rw-r--r-- | doc/lzlib.info | 54 | ||||
-rw-r--r-- | doc/lzlib.texinfo | 36 | ||||
-rw-r--r-- | doc/minilzip.1 | 9 | ||||
-rw-r--r-- | encoder.c | 6 | ||||
-rw-r--r-- | encoder.h | 6 | ||||
-rw-r--r-- | lzip.h | 4 | ||||
-rw-r--r-- | lzlib.h | 2 | ||||
-rw-r--r-- | main.c | 13 |
15 files changed, 80 insertions, 85 deletions
@@ -1,6 +1,6 @@ -2013-07-28 Antonio Diaz Diaz <antonio@gnu.org> +2013-09-15 Antonio Diaz Diaz <antonio@gnu.org> - * Version 1.5-rc1 released. + * Version 1.5 released. * Removed decompression support for version 0 files. * The LZ_compress_sync_flush mechanism has been fixed (again). * Minor fixes. diff --git a/Makefile.in b/Makefile.in index 7be45f7..66967c5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -68,8 +68,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 $@ --no-info ./$(progname) + help2man -n 'reduces the size of files' -o $@ --no-info ./$(progname) Makefile : $(VPATH)/configure $(VPATH)/Makefile.in ./config.status @@ -5,4 +5,4 @@ Decompression support for deprecated version 0 files has been removed. A bug has been fixed that would make an instance of "struct LZ_Encoder" unresponsive if "LZ_compress_sync_flush" is called at the wrong moment. -Minor fixes. +Minor fixes have been made. diff --git a/carg_parser.c b/carg_parser.c index a86f76f..378b5e3 100644 --- a/carg_parser.c +++ b/carg_parser.c @@ -45,7 +45,7 @@ static char push_back_record( struct Arg_parser * const ap, const int code, const char * const argument ) { const int len = strlen( argument ); - struct ap_Record *p; + struct ap_Record * p; void * tmp = ap_resize_buffer( ap->data, ( ap->data_size + 1 ) * sizeof (struct ap_Record) ); if( !tmp ) return 0; @@ -222,12 +222,12 @@ char ap_init( struct Arg_parser * const ap, 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 "--" */ @@ -6,7 +6,7 @@ # to copy, distribute and modify it. pkgname=lzlib -pkgversion=1.5-rc1 +pkgversion=1.5 soversion=1 progname=minilzip progname_shared= @@ -88,13 +88,7 @@ static int LZd_decode_member( struct LZ_decoder * const decoder ) int len; if( Rd_decode_bit( rdec, &decoder->bm_rep[*state] ) == 1 ) /* 2nd bit */ { - if( Rd_decode_bit( rdec, &decoder->bm_rep0[*state] ) == 0 ) /* 3rd bit */ - { - if( Rd_decode_bit( rdec, &decoder->bm_len[*state][pos_state] ) == 0 ) /* 4th bit */ - { *state = St_set_short_rep( *state ); - LZd_put_byte( decoder, LZd_get_byte( decoder, decoder->rep0 ) ); continue; } - } - else + if( Rd_decode_bit( rdec, &decoder->bm_rep0[*state] ) == 1 ) /* 3rd bit */ { unsigned distance; if( Rd_decode_bit( rdec, &decoder->bm_rep1[*state] ) == 0 ) /* 4th bit */ @@ -110,6 +104,12 @@ static int LZd_decode_member( struct LZ_decoder * const decoder ) decoder->rep1 = decoder->rep0; decoder->rep0 = distance; } + else + { + if( Rd_decode_bit( rdec, &decoder->bm_len[*state][pos_state] ) == 0 ) /* 4th bit */ + { *state = St_set_short_rep( *state ); + LZd_put_byte( decoder, LZd_get_byte( decoder, decoder->rep0 ) ); continue; } + } *state = St_set_rep( *state ); len = min_match_len + Rd_decode_len( rdec, &decoder->rep_len_model, pos_state ); } @@ -326,7 +326,7 @@ struct LZ_decoder Bit_model bm_rep1[states]; Bit_model bm_rep2[states]; Bit_model bm_len[states][pos_states]; - Bit_model bm_dis_slot[max_dis_states][1<<dis_slot_bits]; + Bit_model bm_dis_slot[dis_states][1<<dis_slot_bits]; Bit_model bm_dis[modeled_distances-end_dis_model]; Bit_model bm_align[dis_align_size]; @@ -405,7 +405,7 @@ static inline bool LZd_init( struct LZ_decoder * const decoder, Bm_array_init( decoder->bm_rep1, states ); Bm_array_init( decoder->bm_rep2, states ); Bm_array_init( decoder->bm_len[0], states * pos_states ); - Bm_array_init( decoder->bm_dis_slot[0], max_dis_states * (1 << dis_slot_bits) ); + Bm_array_init( decoder->bm_dis_slot[0], dis_states * (1 << dis_slot_bits) ); Bm_array_init( decoder->bm_dis, modeled_distances - end_dis_model ); Bm_array_init( decoder->bm_align, dis_align_size ); diff --git a/doc/lzlib.info b/doc/lzlib.info index 47460f9..683b18e 100644 --- a/doc/lzlib.info +++ b/doc/lzlib.info @@ -12,7 +12,7 @@ File: lzlib.info, Node: Top, Next: Introduction, Up: (dir) Lzlib Manual ************ -This manual is for Lzlib (version 1.5-rc1, 28 July 2013). +This manual is for Lzlib (version 1.5, 15 September 2013). * Menu: @@ -126,17 +126,17 @@ minimum sizes: * Input compression buffer. Written to by the `LZ_compress_write' function. Its size is two times the dictionary size set with the - `LZ_compress_open' function or 64KiB, whichever is larger. + `LZ_compress_open' function or 64 KiB, whichever is larger. * Output compression buffer. Read from by the `LZ_compress_read' - function. Its size is 64KiB. + function. Its size is 64 KiB. * Input decompression buffer. Written to by the - `LZ_decompress_write' function. Its size is 64KiB. + `LZ_decompress_write' function. Its size is 64 KiB. * Output decompression buffer. Read from by the `LZ_decompress_read' function. Its size is the dictionary size set in the header of the - member currently being decompressed or 64KiB, whichever is larger. + member currently being decompressed or 64 KiB, whichever is larger. File: lzlib.info, Node: Parameter limits, Next: Compression functions, Prev: Buffering, Up: Top @@ -152,14 +152,14 @@ Current values are shown in square brackets. [12]. -- Function: int LZ_min_dictionary_size ( void ) - Returns the smallest valid dictionary size [4KiB]. + Returns the smallest valid dictionary size [4 KiB]. -- Function: int LZ_max_dictionary_bits ( void ) Returns the base 2 logarithm of the largest valid dictionary size [29]. -- Function: int LZ_max_dictionary_size ( void ) - Returns the largest valid dictionary size [512MiB]. + Returns the largest valid dictionary size [512 MiB]. -- Function: int LZ_min_match_len_limit ( void ) Returns the smallest valid match length limit [5]. @@ -192,9 +192,9 @@ calling `LZ_compress_errno' before using it. should be freed with `LZ_compress_close' to avoid memory leaks. DICTIONARY_SIZE sets the dictionary size to be used, in bytes. - Valid values range from 4KiB to 512MiB. Note that dictionary sizes - are quantized. If the specified size does not match one of the - valid sizes, it will be rounded upwards by adding up to + Valid values range from 4 KiB to 512 MiB. Note that dictionary + sizes are quantized. If the specified size does not match one of + the valid sizes, it will be rounded upwards by adding up to (DICTIONARY_SIZE / 16) to it. MATCH_LEN_LIMIT sets the match length limit in bytes. Valid values @@ -202,7 +202,7 @@ calling `LZ_compress_errno' before using it. ratios but longer compression times. MEMBER_SIZE sets the member size limit in bytes. Minimum member - size limit is 100kB. Small member size may degrade compression + size limit is 100 kB. Small member size may degrade compression ratio, so use it only when needed. To produce a single-member data stream, give MEMBER_SIZE a value larger than the amount of data to be produced, for example INT64_MAX. @@ -536,7 +536,7 @@ with no additional information before, between, or after them. `ID string' A four byte string, identifying the lzip format, with the value - "LZIP". + "LZIP" (0x4C, 0x5A, 0x49, 0x50). `VN (version number, 1 byte)' Just in case something needs to be modified in the future. 1 for @@ -551,8 +551,8 @@ with no additional information before, between, or after them. Bits 4-0 contain the base 2 logarithm of the base size (12 to 29). Bits 7-5 contain the number of wedges (0 to 7) to substract from the base size to obtain the dictionary size. - Example: 0xD3 = (2^19 - 6 * 2^15) = (512KiB - 6 * 32KiB) = 320KiB - Valid values for dictionary size range from 4KiB to 512MiB. + Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB + Valid values for dictionary size range from 4 KiB to 512 MiB. `Lzma stream' The lzma stream, finished by an end of stream marker. Uses default @@ -697,7 +697,7 @@ next member in case of data error. File: lzlib.info, Node: Problems, Next: Concept index, Prev: Examples, Up: Top -11 Reporting Bugs +11 Reporting bugs ***************** There are probably bugs in Lzlib. There are certainly errors and @@ -737,18 +737,18 @@ Concept index Tag Table: Node: Top217 -Node: Introduction1322 -Node: Library version3903 -Node: Buffering4548 -Node: Parameter limits5667 -Node: Compression functions6624 -Node: Decompression functions12834 -Node: Error codes18995 -Node: Error messages20934 -Node: Data format21513 -Node: Examples24136 -Node: Problems28219 -Node: Concept index28791 +Node: Introduction1323 +Node: Library version3904 +Node: Buffering4549 +Node: Parameter limits5672 +Node: Compression functions6631 +Node: Decompression functions12844 +Node: Error codes19005 +Node: Error messages20944 +Node: Data format21523 +Node: Examples24172 +Node: Problems28255 +Node: Concept index28827 End Tag Table diff --git a/doc/lzlib.texinfo b/doc/lzlib.texinfo index 2830694..ed0b545 100644 --- a/doc/lzlib.texinfo +++ b/doc/lzlib.texinfo @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 28 July 2013 -@set VERSION 1.5-rc1 +@set UPDATED 15 September 2013 +@set VERSION 1.5 @dircategory Data Compression @direntry @@ -147,18 +147,18 @@ sizes: @itemize @bullet @item Input compression buffer. Written to by the @samp{LZ_compress_write} function. Its size is two times the dictionary -size set with the @samp{LZ_compress_open} function or 64KiB, whichever +size set with the @samp{LZ_compress_open} function or 64 KiB, whichever is larger. @item Output compression buffer. Read from by the -@samp{LZ_compress_read} function. Its size is 64KiB. +@samp{LZ_compress_read} function. Its size is 64 KiB. @item Input decompression buffer. Written to by the -@samp{LZ_decompress_write} function. Its size is 64KiB. +@samp{LZ_decompress_write} function. Its size is 64 KiB. @item Output decompression buffer. Read from by the @samp{LZ_decompress_read} function. Its size is the dictionary size set -in the header of the member currently being decompressed or 64KiB, +in the header of the member currently being decompressed or 64 KiB, whichever is larger. @end itemize @@ -175,7 +175,7 @@ Returns the base 2 logarithm of the smallest valid dictionary size [12]. @end deftypefun @deftypefun int LZ_min_dictionary_size ( void ) -Returns the smallest valid dictionary size [4KiB]. +Returns the smallest valid dictionary size [4 KiB]. @end deftypefun @deftypefun int LZ_max_dictionary_bits ( void ) @@ -183,7 +183,7 @@ Returns the base 2 logarithm of the largest valid dictionary size [29]. @end deftypefun @deftypefun int LZ_max_dictionary_size ( void ) -Returns the largest valid dictionary size [512MiB]. +Returns the largest valid dictionary size [512 MiB]. @end deftypefun @deftypefun int LZ_min_match_len_limit ( void ) @@ -217,7 +217,7 @@ does not return @samp{LZ_ok}, the returned pointer must not be used and should be freed with @samp{LZ_compress_close} to avoid memory leaks. @var{dictionary_size} sets the dictionary size to be used, in bytes. -Valid values range from 4KiB to 512MiB. Note that dictionary sizes are +Valid values range from 4 KiB to 512 MiB. Note that dictionary sizes are quantized. If the specified size does not match one of the valid sizes, it will be rounded upwards by adding up to (@var{dictionary_size} / 16) to it. @@ -227,7 +227,7 @@ range from 5 to 273. Larger values usually give better compression ratios but longer compression times. @var{member_size} sets the member size limit in bytes. Minimum member -size limit is 100kB. Small member size may degrade compression ratio, so +size limit is 100 kB. Small member size may degrade compression ratio, so use it only when needed. To produce a single-member data stream, give @var{member_size} a value larger than the amount of data to be produced, for example INT64_MAX. @@ -607,7 +607,8 @@ All multibyte values are stored in little endian order. @table @samp @item ID string -A four byte string, identifying the lzip format, with the value "LZIP". +A four byte string, identifying the lzip format, with the value "LZIP" +(0x4C, 0x5A, 0x49, 0x50). @item VN (version number, 1 byte) Just in case something needs to be modified in the future. 1 for now. @@ -620,8 +621,8 @@ wedges between 0 and 7. The size of a wedge is (base_size / 16).@* Bits 4-0 contain the base 2 logarithm of the base size (12 to 29).@* Bits 7-5 contain the number of wedges (0 to 7) to substract from the base size to obtain the dictionary size.@* -Example: 0xD3 = (2^19 - 6 * 2^15) = (512KiB - 6 * 32KiB) = 320KiB@* -Valid values for dictionary size range from 4KiB to 512MiB. +Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB@* +Valid values for dictionary size range from 4 KiB to 512 MiB. @item Lzma stream The lzma stream, finished by an end of stream marker. Uses default values @@ -672,7 +673,6 @@ Example 1: Normal compression (@var{member_size} > total output). 8) LZ_compress_close @end example - @sp 1 @noindent Example 2: Normal compression using LZ_compress_write_size. @@ -687,7 +687,6 @@ Example 2: Normal compression using LZ_compress_write_size. 7) LZ_compress_close @end example - @sp 1 @noindent Example 3: Decompression. @@ -703,7 +702,6 @@ Example 3: Decompression. 8) LZ_decompress_close @end example - @sp 1 @noindent Example 4: Decompression using LZ_decompress_write_size. @@ -720,7 +718,6 @@ Example 4: Decompression using LZ_decompress_write_size. 7) LZ_decompress_close @end example - @sp 1 @noindent Example 5: Multi-member compression (@var{member_size} < total output). @@ -738,7 +735,6 @@ Example 5: Multi-member compression (@var{member_size} < total output). 10) LZ_compress_close @end example - @sp 1 @noindent Example 6: Multi-member compression (user-restarted members). @@ -758,7 +754,6 @@ Example 6: Multi-member compression (user-restarted members). 12) LZ_compress_close @end example - @sp 1 @noindent Example 7: Decompression with automatic removal of leading garbage. @@ -774,7 +769,6 @@ Example 7: Decompression with automatic removal of leading garbage. 8) LZ_decompress_close @end example - @sp 1 @noindent Example 8: Streamed decompression with automatic resynchronization to @@ -793,7 +787,7 @@ next member in case of data error. @node Problems -@chapter Reporting Bugs +@chapter Reporting bugs @cindex bugs @cindex getting help diff --git a/doc/minilzip.1 b/doc/minilzip.1 index da2c211..789c76d 100644 --- a/doc/minilzip.1 +++ b/doc/minilzip.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH MINILZIP "1" "July 2013" "Minilzip 1.5-rc1" "User Commands" +.TH MINILZIP "1" "September 2013" "Minilzip 1.5" "User Commands" .SH NAME Minilzip \- 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 @@ -70,7 +70,8 @@ Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc... The bidimensional parameter space of LZMA can't be mapped to a linear scale optimal for all files. If your files are large, very repetitive, etc, you may need to use the \fB\-\-match\-length\fR and \fB\-\-dictionary\-size\fR -options directly to achieve optimal performance. +options directly to achieve optimal performance. For example, \fB\-9m64\fR +usually compresses executables more (and faster) than \fB\-9\fR. .PP Exit status: 0 for a normal exit, 1 for environmental problems (file not found, invalid flags, I/O errors, etc), 2 to indicate a corrupt or @@ -82,7 +83,7 @@ Report bugs to lzip\-bug@nongnu.org Lzlib home page: http://www.nongnu.org/lzip/lzlib.html .SH COPYRIGHT Copyright \(co 2013 Antonio Diaz Diaz. -Using Lzlib 1.5\-rc1 +Using Lzlib 1.5 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> .br This is free software: you are free to change and redistribute it. @@ -320,11 +320,11 @@ static void LZe_fill_distance_prices( struct LZ_encoder * const encoder ) const int price = price_symbol_reversed( encoder->bm_dis + base - dis_slot - 1, dis - base, direct_bits ); - for( dis_state = 0; dis_state < max_dis_states; ++dis_state ) + for( dis_state = 0; dis_state < dis_states; ++dis_state ) encoder->dis_prices[dis_state][dis] = price; } - for( dis_state = 0; dis_state < max_dis_states; ++dis_state ) + for( dis_state = 0; dis_state < dis_states; ++dis_state ) { int * const dsp = encoder->dis_slot_prices[dis_state]; int * const dp = encoder->dis_prices[dis_state]; @@ -361,7 +361,7 @@ static bool LZe_init( struct LZ_encoder * const encoder, Bm_array_init( encoder->bm_rep1, states ); Bm_array_init( encoder->bm_rep2, states ); Bm_array_init( encoder->bm_len[0], states * pos_states ); - Bm_array_init( encoder->bm_dis_slot[0], max_dis_states * (1 << dis_slot_bits) ); + Bm_array_init( encoder->bm_dis_slot[0], dis_states * (1 << dis_slot_bits) ); Bm_array_init( encoder->bm_dis, modeled_distances - end_dis_model ); Bm_array_init( encoder->bm_align, dis_align_size ); @@ -591,7 +591,7 @@ struct LZ_encoder Bit_model bm_rep1[states]; Bit_model bm_rep2[states]; Bit_model bm_len[states][pos_states]; - Bit_model bm_dis_slot[max_dis_states][1<<dis_slot_bits]; + Bit_model bm_dis_slot[dis_states][1<<dis_slot_bits]; Bit_model bm_dis[modeled_distances-end_dis_model]; Bit_model bm_align[dis_align_size]; @@ -605,8 +605,8 @@ struct LZ_encoder struct Pair pairs[max_match_len+1]; struct 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[dis_states][2*max_dictionary_bits]; + int dis_prices[dis_states][modeled_distances]; int align_prices[dis_align_size]; int align_price_count; int fill_counter; @@ -83,10 +83,10 @@ enum { max_match_len = min_match_len + max_len_symbols - 1, /* 273 */ min_match_len_limit = 5, - max_dis_states = 4 }; + dis_states = 4 }; static inline int get_dis_state( const int len ) - { return min( len - min_match_len, max_dis_states - 1 ); } + { return min( len - min_match_len, dis_states - 1 ); } static inline int get_lit_state( const uint8_t prev_byte ) { return ( prev_byte >> ( 8 - literal_context_bits ) ); } @@ -29,7 +29,7 @@ extern "C" { #endif -static const char * const LZ_version_string = "1.5-rc1"; +static const char * const LZ_version_string = "1.5"; enum LZ_Errno { LZ_ok = 0, LZ_bad_argument, LZ_mem_error, LZ_sequence_error, LZ_header_error, LZ_unexpected_eof, @@ -88,13 +88,11 @@ 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 }; -const unsigned long long max_member_size = 0x1000000000000000ULL; -const unsigned long long max_volume_size = 0x7FFFFFFFFFFFFFFFULL; char * output_filename = 0; int outfd = -1; @@ -161,7 +159,7 @@ static void show_help( void ) " -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" @@ -175,7 +173,8 @@ static void show_help( void ) "The bidimensional parameter space of LZMA can't be mapped to a linear\n" "scale optimal for all files. If your files are large, very repetitive,\n" "etc, you may need to use the --match-length and --dictionary-size\n" - "options directly to achieve optimal performance.\n" + "options directly to achieve optimal performance. For example, -9m64\n" + "usually compresses executables more (and faster) than -9.\n" "\nExit status: 0 for a normal exit, 1 for environmental problems (file\n" "not found, invalid flags, I/O errors, etc), 2 to indicate a corrupt or\n" "invalid input file, 3 for an internal consistency error (eg, bug) which\n" @@ -839,6 +838,8 @@ int main( const int argc, const char * const argv[] ) { 3 << 23, 132 }, /* -8 */ { 1 << 25, 273 } }; /* -9 */ struct Lzma_options encoder_options = option_mapping[6]; /* default = "-6" */ + const unsigned long long max_member_size = 0x0100000000000000ULL; + const unsigned long long max_volume_size = 0x4000000000000000ULL; unsigned long long member_size = max_member_size; unsigned long long volume_size = 0; const char * input_filename = ""; |