1
0
Fork 0

Merging upstream version 1.5.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-20 20:18:54 +01:00
parent ca780e91c2
commit 4658e04973
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
15 changed files with 80 additions and 85 deletions

View file

@ -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. * Removed decompression support for version 0 files.
* The LZ_compress_sync_flush mechanism has been fixed (again). * The LZ_compress_sync_flush mechanism has been fixed (again).
* Minor fixes. * Minor fixes.

View file

@ -68,8 +68,7 @@ $(VPATH)/doc/$(pkgname).info : $(VPATH)/doc/$(pkgname).texinfo
man : $(VPATH)/doc/$(progname).1 man : $(VPATH)/doc/$(progname).1
$(VPATH)/doc/$(progname).1 : $(progname) $(VPATH)/doc/$(progname).1 : $(progname)
help2man -n 'reduces the size of files' \ help2man -n 'reduces the size of files' -o $@ --no-info ./$(progname)
-o $@ --no-info ./$(progname)
Makefile : $(VPATH)/configure $(VPATH)/Makefile.in Makefile : $(VPATH)/configure $(VPATH)/Makefile.in
./config.status ./config.status

2
NEWS
View file

@ -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" 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. unresponsive if "LZ_compress_sync_flush" is called at the wrong moment.
Minor fixes. Minor fixes have been made.

View file

@ -45,7 +45,7 @@ static char push_back_record( struct Arg_parser * const ap,
const int code, const char * const argument ) const int code, const char * const argument )
{ {
const int len = strlen( argument ); const int len = strlen( argument );
struct ap_Record *p; struct ap_Record * p;
void * tmp = ap_resize_buffer( ap->data, void * tmp = ap_resize_buffer( ap->data,
( ap->data_size + 1 ) * sizeof (struct ap_Record) ); ( ap->data_size + 1 ) * sizeof (struct ap_Record) );
if( !tmp ) return 0; if( !tmp ) return 0;
@ -222,12 +222,12 @@ char ap_init( struct Arg_parser * const ap,
while( argind < argc ) while( argind < argc )
{ {
const unsigned char ch1 = argv[argind][0]; 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 */ if( ch1 == '-' && ch2 ) /* we found an option */
{ {
const char * const opt = argv[argind]; 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( ch2 == '-' )
{ {
if( !argv[argind][2] ) { ++argind; break; } /* we found "--" */ if( !argv[argind][2] ) { ++argind; break; } /* we found "--" */

2
configure vendored
View file

@ -6,7 +6,7 @@
# to copy, distribute and modify it. # to copy, distribute and modify it.
pkgname=lzlib pkgname=lzlib
pkgversion=1.5-rc1 pkgversion=1.5
soversion=1 soversion=1
progname=minilzip progname=minilzip
progname_shared= progname_shared=

View file

@ -88,13 +88,7 @@ static int LZd_decode_member( struct LZ_decoder * const decoder )
int len; int len;
if( Rd_decode_bit( rdec, &decoder->bm_rep[*state] ) == 1 ) /* 2nd bit */ 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_rep0[*state] ) == 1 ) /* 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
{ {
unsigned distance; unsigned distance;
if( Rd_decode_bit( rdec, &decoder->bm_rep1[*state] ) == 0 ) /* 4th bit */ 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->rep1 = decoder->rep0;
decoder->rep0 = distance; 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 ); *state = St_set_rep( *state );
len = min_match_len + Rd_decode_len( rdec, &decoder->rep_len_model, pos_state ); len = min_match_len + Rd_decode_len( rdec, &decoder->rep_len_model, pos_state );
} }

View file

@ -326,7 +326,7 @@ struct LZ_decoder
Bit_model bm_rep1[states]; Bit_model bm_rep1[states];
Bit_model bm_rep2[states]; Bit_model bm_rep2[states];
Bit_model bm_len[states][pos_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_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size]; 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_rep1, states );
Bm_array_init( decoder->bm_rep2, states ); Bm_array_init( decoder->bm_rep2, states );
Bm_array_init( decoder->bm_len[0], states * pos_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_dis, modeled_distances - end_dis_model );
Bm_array_init( decoder->bm_align, dis_align_size ); Bm_array_init( decoder->bm_align, dis_align_size );

View file

@ -12,7 +12,7 @@ File: lzlib.info, Node: Top, Next: Introduction, Up: (dir)
Lzlib Manual 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: * Menu:
@ -126,17 +126,17 @@ minimum sizes:
* Input compression buffer. Written to by the `LZ_compress_write' * Input compression buffer. Written to by the `LZ_compress_write'
function. Its size is two times the dictionary size set with the 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' * 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 * 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' * Output decompression buffer. Read from by the `LZ_decompress_read'
function. Its size is the dictionary size set in the header of the 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 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]. [12].
-- Function: int LZ_min_dictionary_size ( void ) -- 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 ) -- Function: int LZ_max_dictionary_bits ( void )
Returns the base 2 logarithm of the largest valid dictionary size Returns the base 2 logarithm of the largest valid dictionary size
[29]. [29].
-- Function: int LZ_max_dictionary_size ( void ) -- 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 ) -- Function: int LZ_min_match_len_limit ( void )
Returns the smallest valid match length limit [5]. 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. should be freed with `LZ_compress_close' to avoid memory leaks.
DICTIONARY_SIZE sets the dictionary size to be used, in bytes. DICTIONARY_SIZE sets the dictionary size to be used, in bytes.
Valid values range from 4KiB to 512MiB. Note that dictionary sizes Valid values range from 4 KiB to 512 MiB. Note that dictionary
are quantized. If the specified size does not match one of the sizes are quantized. If the specified size does not match one of
valid sizes, it will be rounded upwards by adding up to the valid sizes, it will be rounded upwards by adding up to
(DICTIONARY_SIZE / 16) to it. (DICTIONARY_SIZE / 16) to it.
MATCH_LEN_LIMIT sets the match length limit in bytes. Valid values 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. ratios but longer compression times.
MEMBER_SIZE sets the member size limit in bytes. Minimum member 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 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 stream, give MEMBER_SIZE a value larger than the amount of data to
be produced, for example INT64_MAX. be produced, for example INT64_MAX.
@ -536,7 +536,7 @@ with no additional information before, between, or after them.
`ID string' `ID string'
A four byte string, identifying the lzip format, with the value A four byte string, identifying the lzip format, with the value
"LZIP". "LZIP" (0x4C, 0x5A, 0x49, 0x50).
`VN (version number, 1 byte)' `VN (version number, 1 byte)'
Just in case something needs to be modified in the future. 1 for 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 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 Bits 7-5 contain the number of wedges (0 to 7) to substract from
the base size to obtain the dictionary size. the base size to obtain the dictionary size.
Example: 0xD3 = (2^19 - 6 * 2^15) = (512KiB - 6 * 32KiB) = 320KiB Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB
Valid values for dictionary size range from 4KiB to 512MiB. Valid values for dictionary size range from 4 KiB to 512 MiB.
`Lzma stream' `Lzma stream'
The lzma stream, finished by an end of stream marker. Uses default 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 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 There are probably bugs in Lzlib. There are certainly errors and
@ -737,18 +737,18 @@ Concept index
 
Tag Table: Tag Table:
Node: Top217 Node: Top217
Node: Introduction1322 Node: Introduction1323
Node: Library version3903 Node: Library version3904
Node: Buffering4548 Node: Buffering4549
Node: Parameter limits5667 Node: Parameter limits5672
Node: Compression functions6624 Node: Compression functions6631
Node: Decompression functions12834 Node: Decompression functions12844
Node: Error codes18995 Node: Error codes19005
Node: Error messages20934 Node: Error messages20944
Node: Data format21513 Node: Data format21523
Node: Examples24136 Node: Examples24172
Node: Problems28219 Node: Problems28255
Node: Concept index28791 Node: Concept index28827
 
End Tag Table End Tag Table

View file

@ -6,8 +6,8 @@
@finalout @finalout
@c %**end of header @c %**end of header
@set UPDATED 28 July 2013 @set UPDATED 15 September 2013
@set VERSION 1.5-rc1 @set VERSION 1.5
@dircategory Data Compression @dircategory Data Compression
@direntry @direntry
@ -147,18 +147,18 @@ sizes:
@itemize @bullet @itemize @bullet
@item Input compression buffer. Written to by the @item Input compression buffer. Written to by the
@samp{LZ_compress_write} function. Its size is two times the dictionary @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. is larger.
@item Output compression buffer. Read from by the @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 @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 @item Output decompression buffer. Read from by the
@samp{LZ_decompress_read} function. Its size is the dictionary size set @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. whichever is larger.
@end itemize @end itemize
@ -175,7 +175,7 @@ Returns the base 2 logarithm of the smallest valid dictionary size [12].
@end deftypefun @end deftypefun
@deftypefun int LZ_min_dictionary_size ( void ) @deftypefun int LZ_min_dictionary_size ( void )
Returns the smallest valid dictionary size [4KiB]. Returns the smallest valid dictionary size [4 KiB].
@end deftypefun @end deftypefun
@deftypefun int LZ_max_dictionary_bits ( void ) @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 @end deftypefun
@deftypefun int LZ_max_dictionary_size ( void ) @deftypefun int LZ_max_dictionary_size ( void )
Returns the largest valid dictionary size [512MiB]. Returns the largest valid dictionary size [512 MiB].
@end deftypefun @end deftypefun
@deftypefun int LZ_min_match_len_limit ( void ) @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. should be freed with @samp{LZ_compress_close} to avoid memory leaks.
@var{dictionary_size} sets the dictionary size to be used, in bytes. @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, 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) it will be rounded upwards by adding up to (@var{dictionary_size} / 16)
to it. to it.
@ -227,7 +227,7 @@ range from 5 to 273. Larger values usually give better compression
ratios but longer compression times. ratios but longer compression times.
@var{member_size} sets the member size limit in bytes. Minimum member @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 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, @var{member_size} a value larger than the amount of data to be produced,
for example INT64_MAX. for example INT64_MAX.
@ -607,7 +607,8 @@ All multibyte values are stored in little endian order.
@table @samp @table @samp
@item ID string @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) @item VN (version number, 1 byte)
Just in case something needs to be modified in the future. 1 for now. 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 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 Bits 7-5 contain the number of wedges (0 to 7) to substract from the
base size to obtain the dictionary size.@* base size to obtain the dictionary size.@*
Example: 0xD3 = (2^19 - 6 * 2^15) = (512KiB - 6 * 32KiB) = 320KiB@* Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB@*
Valid values for dictionary size range from 4KiB to 512MiB. Valid values for dictionary size range from 4 KiB to 512 MiB.
@item Lzma stream @item Lzma stream
The lzma stream, finished by an end of stream marker. Uses default values 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 8) LZ_compress_close
@end example @end example
@sp 1 @sp 1
@noindent @noindent
Example 2: Normal compression using LZ_compress_write_size. 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 7) LZ_compress_close
@end example @end example
@sp 1 @sp 1
@noindent @noindent
Example 3: Decompression. Example 3: Decompression.
@ -703,7 +702,6 @@ Example 3: Decompression.
8) LZ_decompress_close 8) LZ_decompress_close
@end example @end example
@sp 1 @sp 1
@noindent @noindent
Example 4: Decompression using LZ_decompress_write_size. Example 4: Decompression using LZ_decompress_write_size.
@ -720,7 +718,6 @@ Example 4: Decompression using LZ_decompress_write_size.
7) LZ_decompress_close 7) LZ_decompress_close
@end example @end example
@sp 1 @sp 1
@noindent @noindent
Example 5: Multi-member compression (@var{member_size} < total output). 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 10) LZ_compress_close
@end example @end example
@sp 1 @sp 1
@noindent @noindent
Example 6: Multi-member compression (user-restarted members). Example 6: Multi-member compression (user-restarted members).
@ -758,7 +754,6 @@ Example 6: Multi-member compression (user-restarted members).
12) LZ_compress_close 12) LZ_compress_close
@end example @end example
@sp 1 @sp 1
@noindent @noindent
Example 7: Decompression with automatic removal of leading garbage. 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 8) LZ_decompress_close
@end example @end example
@sp 1 @sp 1
@noindent @noindent
Example 8: Streamed decompression with automatic resynchronization to Example 8: Streamed decompression with automatic resynchronization to
@ -793,7 +787,7 @@ next member in case of data error.
@node Problems @node Problems
@chapter Reporting Bugs @chapter Reporting bugs
@cindex bugs @cindex bugs
@cindex getting help @cindex getting help

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. .\" 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 .SH NAME
Minilzip \- reduces the size of files Minilzip \- reduces the size of files
.SH SYNOPSIS .SH SYNOPSIS
@ -43,7 +43,7 @@ if reading stdin, place the output into <file>
suppress all messages suppress all messages
.TP .TP
\fB\-s\fR, \fB\-\-dictionary\-size=\fR<bytes> \fB\-s\fR, \fB\-\-dictionary\-size=\fR<bytes>
set dictionary size limit in bytes [8MiB] set dictionary size limit in bytes [8 MiB]
.TP .TP
\fB\-S\fR, \fB\-\-volume\-size=\fR<bytes> \fB\-S\fR, \fB\-\-volume\-size=\fR<bytes>
set volume size limit in 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 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, 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 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 .PP
Exit status: 0 for a normal exit, 1 for environmental problems (file 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 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 Lzlib home page: http://www.nongnu.org/lzip/lzlib.html
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2013 Antonio Diaz Diaz. 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> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
.br .br
This is free software: you are free to change and redistribute it. This is free software: you are free to change and redistribute it.

View file

@ -320,11 +320,11 @@ static void LZe_fill_distance_prices( struct LZ_encoder * const encoder )
const int price = const int price =
price_symbol_reversed( encoder->bm_dis + base - dis_slot - 1, price_symbol_reversed( encoder->bm_dis + base - dis_slot - 1,
dis - base, direct_bits ); 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; 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 dsp = encoder->dis_slot_prices[dis_state];
int * const dp = encoder->dis_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_rep1, states );
Bm_array_init( encoder->bm_rep2, states ); Bm_array_init( encoder->bm_rep2, states );
Bm_array_init( encoder->bm_len[0], states * pos_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_dis, modeled_distances - end_dis_model );
Bm_array_init( encoder->bm_align, dis_align_size ); Bm_array_init( encoder->bm_align, dis_align_size );

View file

@ -591,7 +591,7 @@ struct LZ_encoder
Bit_model bm_rep1[states]; Bit_model bm_rep1[states];
Bit_model bm_rep2[states]; Bit_model bm_rep2[states];
Bit_model bm_len[states][pos_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_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size]; Bit_model bm_align[dis_align_size];
@ -605,8 +605,8 @@ struct LZ_encoder
struct Pair pairs[max_match_len+1]; struct Pair pairs[max_match_len+1];
struct Trial trials[max_num_trials]; struct Trial trials[max_num_trials];
int dis_slot_prices[max_dis_states][2*max_dictionary_bits]; int dis_slot_prices[dis_states][2*max_dictionary_bits];
int dis_prices[max_dis_states][modeled_distances]; int dis_prices[dis_states][modeled_distances];
int align_prices[dis_align_size]; int align_prices[dis_align_size];
int align_price_count; int align_price_count;
int fill_counter; int fill_counter;

4
lzip.h
View file

@ -83,10 +83,10 @@ enum {
max_match_len = min_match_len + max_len_symbols - 1, /* 273 */ 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 }; dis_states = 4 };
static inline int get_dis_state( const int len ) 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 ) static inline int get_lit_state( const uint8_t prev_byte )
{ return ( prev_byte >> ( 8 - literal_context_bits ) ); } { return ( prev_byte >> ( 8 - literal_context_bits ) ); }

View file

@ -29,7 +29,7 @@
extern "C" { extern "C" {
#endif #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, enum LZ_Errno { LZ_ok = 0, LZ_bad_argument, LZ_mem_error,
LZ_sequence_error, LZ_header_error, LZ_unexpected_eof, LZ_sequence_error, LZ_header_error, LZ_unexpected_eof,

13
main.c
View file

@ -88,13 +88,11 @@ struct { const char * from; const char * to; } const known_extensions[] = {
struct Lzma_options struct Lzma_options
{ {
int dictionary_size; /* 4KiB..512MiB */ int dictionary_size; /* 4 KiB .. 512 MiB */
int match_len_limit; /* 5..273 */ int match_len_limit; /* 5 .. 273 */
}; };
enum Mode { m_compress, m_decompress, m_test }; 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; char * output_filename = 0;
int outfd = -1; int outfd = -1;
@ -161,7 +159,7 @@ static void show_help( void )
" -m, --match-length=<bytes> set match length limit in bytes [36]\n" " -m, --match-length=<bytes> set match length limit in bytes [36]\n"
" -o, --output=<file> if reading stdin, place the output into <file>\n" " -o, --output=<file> if reading stdin, place the output into <file>\n"
" -q, --quiet suppress all messages\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" " -S, --volume-size=<bytes> set volume size limit in bytes\n"
" -t, --test test compressed file integrity\n" " -t, --test test compressed file integrity\n"
" -v, --verbose be verbose (a 2nd -v gives more)\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" "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" "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" "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" "\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" "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" "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 */ { 3 << 23, 132 }, /* -8 */
{ 1 << 25, 273 } }; /* -9 */ { 1 << 25, 273 } }; /* -9 */
struct Lzma_options encoder_options = option_mapping[6]; /* default = "-6" */ 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 member_size = max_member_size;
unsigned long long volume_size = 0; unsigned long long volume_size = 0;
const char * input_filename = ""; const char * input_filename = "";