1
0
Fork 0

Merging upstream version 1.7.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-20 20:55:25 +01:00
parent 9440f43b75
commit add5861cbc
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
15 changed files with 94 additions and 96 deletions

View file

@ -1,12 +1,6 @@
2015-05-23 Antonio Diaz Diaz <antonio@gnu.org>
2015-07-08 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.7-rc1 released.
* main.c: Enable fast encoder only with option '-0'.
* Minor improvements.
2015-02-24 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.7-pre1 released.
* Version 1.7 released.
* Ported fast encoder and option '-0' from lzip.
* If open-->write-->finish, produce same dictionary size as lzip.
* Makefile.in: Added new targets 'install*-compress'.

View file

@ -33,8 +33,8 @@ the main archive.
documentation. (You may need to run ldconfig also).
Or type 'make install-compress', which additionally compresses the
info manual and the man page after installation. (Installing
compressed docs may become the default in the future).
info manual after installation. (Installing compressed docs may
become the default in the future).
You can install only the library, the info manual or the man page by
typing 'make install-bin', 'make install-info' or 'make install-man'

2
README
View file

@ -71,7 +71,7 @@ used by lzip could be developed, and the resulting sequence could also
be coded using the LZMA coding scheme.
Lzlib currently implements two variants of the LZMA algorithm; fast
(used by option -0 of minilzip) and normal (used by all other
(used by option '-0' of minilzip) and normal (used by all other
compression levels).
The high compression of LZMA comes from combining two basic, well-proven

View file

@ -157,7 +157,7 @@ int main( const int argc, const char * const argv[] )
if( argc < 2 )
{
fprintf( stderr, "Usage: bbexample filename\n" );
fputs( "Usage: bbexample filename\n", stderr );
return 1;
}
@ -171,7 +171,7 @@ int main( const int argc, const char * const argv[] )
in_buffer = (uint8_t *)malloc( in_buffer_size );
if( !in_buffer )
{
fprintf( stderr, "bbexample: Not enough memory.\n" );
fputs( "bbexample: Not enough memory.\n", stderr );
return 1;
}
@ -186,21 +186,21 @@ int main( const int argc, const char * const argv[] )
mid_buffer = bbcompress( in_buffer, in_size, &mid_size );
if( !mid_buffer )
{
fprintf( stderr, "bbexample: Not enough memory or compress error.\n" );
fputs( "bbexample: Not enough memory or compress error.\n", stderr );
return 1;
}
out_buffer = bbdecompress( mid_buffer, mid_size, &out_size );
if( !out_buffer )
{
fprintf( stderr, "bbexample: Not enough memory or decompress error.\n" );
fputs( "bbexample: Not enough memory or decompress error.\n", stderr );
return 1;
}
if( in_size != out_size ||
( in_size > 0 && memcmp( in_buffer, out_buffer, in_size ) != 0 ) )
{
fprintf( stderr, "bbexample: Decompressed data differs from original.\n" );
fputs( "bbexample: Decompressed data differs from original.\n", stderr );
return 1;
}

2
configure vendored
View file

@ -6,7 +6,7 @@
# to copy, distribute and modify it.
pkgname=lzlib
pkgversion=1.7-rc1
pkgversion=1.7
soversion=1
progname=minilzip
progname_static=${progname}

View file

@ -81,7 +81,7 @@ static int LZd_decode_member( struct LZ_decoder * const d )
LZd_peek( d, d->rep0 ) ) );
}
}
else
else /* match or repeated match */
{
int len;
if( Rd_decode_bit( rdec, &d->bm_rep[*state] ) != 0 ) /* 2nd bit */
@ -111,7 +111,7 @@ static int LZd_decode_member( struct LZ_decoder * const d )
*state = St_set_rep( *state );
len = min_match_len + Rd_decode_len( rdec, &d->rep_len_model, pos_state );
}
else
else /* match */
{
int dis_slot;
const unsigned rep0_saved = d->rep0;

View file

@ -11,13 +11,13 @@ File: lzlib.info, Node: Top, Next: Introduction, Up: (dir)
Lzlib Manual
************
This manual is for Lzlib (version 1.7-rc1, 23 May 2015).
This manual is for Lzlib (version 1.7, 8 July 2015).
* Menu:
* Introduction:: Purpose and features of Lzlib
* Introduction:: Purpose and features of lzlib
* Library version:: Checking library version
* Buffering:: Sizes of Lzlib's buffers
* Buffering:: Sizes of lzlib's buffers
* Parameter limits:: Min / max values for some parameters
* Compression functions:: Descriptions of the compression functions
* Decompression functions:: Descriptions of the decompression functions
@ -53,7 +53,8 @@ availability:
recovery means. The lziprecover program can repair bit-flip errors
(one of the most common forms of data corruption) in lzip files,
and provides data recovery capabilities, including error-checked
merging of damaged copies of a file.
merging of damaged copies of a file. *note Data safety:
(lziprecover)Data safety.
* The lzip format is as simple as possible (but not simpler). The
lzip manual provides the code of a simple decompressor along with
@ -112,7 +113,7 @@ the one currently used by lzip could be developed, and the resulting
sequence could also be coded using the LZMA coding scheme.
Lzlib currently implements two variants of the LZMA algorithm; fast
(used by option -0 of minilzip) and normal (used by all other
(used by option '-0' of minilzip) and normal (used by all other
compression levels).
The high compression of LZMA comes from combining two basic,
@ -243,7 +244,7 @@ calling 'LZ_compress_errno' before using it.
If DICTIONARY_SIZE is 65535 and MATCH_LEN_LIMIT is 16, the fast
variant of LZMA is chosen, which produces identical compressed
output as 'lzip -0'. (The DICTIONARY_SIZE used will be rounded
output as 'lzip -0'. (The dictionary size used will be rounded
upwards to 64 KiB).
MEMBER_SIZE sets the member size limit in bytes. Minimum member
@ -747,12 +748,12 @@ File: lzlib.info, Node: Problems, Next: Concept index, Prev: Examples, Up: T
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
omissions in this manual. If you report them, they will get fixed. If
you don't, no one will ever know about them and they will remain unfixed
for all eternity, if not longer.
If you find a bug in Lzlib, please send electronic mail to
If you find a bug in lzlib, please send electronic mail to
<lzip-bug@nongnu.org>. Include the version number, which you can find
by running 'minilzip --version' or in 'LZ_version_string' from
'lzlib.h'.
@ -784,18 +785,18 @@ Concept index

Tag Table:
Node: Top220
Node: Introduction1305
Node: Library version5869
Node: Buffering6514
Node: Parameter limits7734
Node: Compression functions8693
Node: Decompression functions15237
Node: Error codes21405
Node: Error messages23344
Node: Data format23923
Node: Examples26469
Node: Problems30555
Node: Concept index31127
Node: Introduction1301
Node: Library version5918
Node: Buffering6563
Node: Parameter limits7783
Node: Compression functions8742
Node: Decompression functions15286
Node: Error codes21454
Node: Error messages23393
Node: Data format23972
Node: Examples26518
Node: Problems30604
Node: Concept index31176

End Tag Table

View file

@ -6,8 +6,8 @@
@finalout
@c %**end of header
@set UPDATED 23 May 2015
@set VERSION 1.7-rc1
@set UPDATED 8 July 2015
@set VERSION 1.7
@dircategory Data Compression
@direntry
@ -35,9 +35,9 @@
This manual is for Lzlib (version @value{VERSION}, @value{UPDATED}).
@menu
* Introduction:: Purpose and features of Lzlib
* Introduction:: Purpose and features of lzlib
* Library version:: Checking library version
* Buffering:: Sizes of Lzlib's buffers
* Buffering:: Sizes of lzlib's buffers
* Parameter limits:: Min / max values for some parameters
* Compression functions:: Descriptions of the compression functions
* Decompression functions:: Descriptions of the decompression functions
@ -72,10 +72,14 @@ availability:
@itemize @bullet
@item
The lzip format provides very safe integrity checking and some data
recovery means. The lziprecover program can repair bit-flip errors (one
of the most common forms of data corruption) in lzip files, and provides
data recovery capabilities, including error-checked merging of damaged
copies of a file.
recovery means. The
@uref{http://www.nongnu.org/lzip/manual/lziprecover_manual.html#Data-safety,,lziprecover}
program can repair bit-flip errors (one of the most common forms of data
corruption) in lzip files, and provides data recovery capabilities,
including error-checked merging of damaged copies of a file.
@ifnothtml
@ref{Data safety,,,lziprecover}.
@end ifnothtml
@item
The lzip format is as simple as possible (but not simpler). The lzip
@ -128,7 +132,7 @@ data, so the library should never crash even in case of corrupted input.
In spite of its name (Lempel-Ziv-Markov chain-Algorithm), LZMA is not a
concrete algorithm; it is more like "any algorithm using the LZMA coding
scheme". For example, the option '-0' of lzip uses the scheme in almost
scheme". For example, the option @samp{-0} of lzip uses the scheme in almost
the simplest way possible; issuing the longest match it can find, or a
literal byte if it can't find a match. Inversely, a much more elaborated
way of finding coding sequences of minimum size than the one currently
@ -136,7 +140,7 @@ used by lzip could be developed, and the resulting sequence could also
be coded using the LZMA coding scheme.
Lzlib currently implements two variants of the LZMA algorithm; fast
(used by option -0 of minilzip) and normal (used by all other
(used by option @samp{-0} of minilzip) and normal (used by all other
compression levels).
The high compression of LZMA comes from combining two basic, well-proven
@ -274,8 +278,8 @@ ratios but longer compression times.
If @var{dictionary_size} is 65535 and @var{match_len_limit} is 16, the
fast variant of LZMA is chosen, which produces identical compressed
output as @code{lzip -0}. (The @var{dictionary_size} used will be
rounded upwards to 64 KiB).
output as @code{lzip -0}. (The dictionary size used will be rounded
upwards to 64 KiB).
@var{member_size} sets the member size limit in bytes. Minimum member
size limit is 100 kB. Small member size may degrade compression ratio, so
@ -852,12 +856,12 @@ next member in case of data error.
@cindex bugs
@cindex getting help
There are probably bugs in Lzlib. There are certainly errors and
There are probably bugs in lzlib. There are certainly errors and
omissions in this manual. If you report them, they will get fixed. If
you don't, no one will ever know about them and they will remain unfixed
for all eternity, if not longer.
If you find a bug in Lzlib, please send electronic mail to
If you find a bug in lzlib, please send electronic mail to
@email{lzip-bug@@nongnu.org}. Include the version number, which you can
find by running @w{@code{minilzip --version}} or in
@samp{LZ_version_string} from @samp{lzlib.h}.

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
.TH MINILZIP "1" "May 2015" "minilzip 1.7-rc1" "User Commands"
.TH MINILZIP "1" "July 2015" "minilzip 1.7" "User Commands"
.SH NAME
minilzip \- reduces the size of files
.SH SYNOPSIS
@ -28,7 +28,7 @@ decompress
overwrite existing output files
.TP
\fB\-F\fR, \fB\-\-recompress\fR
force recompression of compressed files
force re\-compression of compressed files
.TP
\fB\-k\fR, \fB\-\-keep\fR
keep (don't delete) input files
@ -82,7 +82,7 @@ Report bugs to lzip\-bug@nongnu.org
Lzlib home page: http://www.nongnu.org/lzip/lzlib.html
.SH COPYRIGHT
Copyright \(co 2015 Antonio Diaz Diaz.
Using lzlib 1.7\-rc1
Using lzlib 1.7
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
.br
This is free software: you are free to change and redistribute it.

View file

@ -53,7 +53,8 @@ static bool Mb_init( struct Matchfinder_base * const mb,
const int num_prev_positions23,
const int pos_array_factor )
{
const int buffer_size_limit = ( dict_factor * dict_size ) + before + after_size;
const int buffer_size_limit =
( dict_factor * dict_size ) + before + after_size;
unsigned size;
int i;

View file

@ -49,10 +49,10 @@ int lzcheck( FILE * const file, const int dictionary_size )
LZ_compress_close( encoder );
if( mem_error )
{
fprintf( stderr, "lzcheck: Not enough memory.\n" );
fputs( "lzcheck: Not enough memory.\n", stderr );
return 1;
}
fprintf( stderr, "lzcheck: internal error: Invalid argument to encoder.\n" );
fputs( "lzcheck: internal error: Invalid argument to encoder.\n", stderr );
return 3;
}
@ -60,7 +60,7 @@ int lzcheck( FILE * const file, const int dictionary_size )
if( !decoder || LZ_decompress_errno( decoder ) != LZ_ok )
{
LZ_decompress_close( decoder );
fprintf( stderr, "lzcheck: Not enough memory.\n" );
fputs( "lzcheck: Not enough memory.\n", stderr );
return 1;
}
@ -80,7 +80,7 @@ int lzcheck( FILE * const file, const int dictionary_size )
mid_size = LZ_compress_read( encoder, mid_buffer, buffer_size );
if( mid_size < 0 )
{
fprintf( stderr, "lzcheck: LZ_compress_read error: %s.\n",
fprintf( stderr, "lzcheck: LZ_compress_read error: %s\n",
LZ_strerror( LZ_compress_errno( encoder ) ) );
retval = 3; break;
}
@ -88,7 +88,7 @@ int lzcheck( FILE * const file, const int dictionary_size )
out_size = LZ_decompress_read( decoder, out_buffer, buffer_size );
if( out_size < 0 )
{
fprintf( stderr, "lzcheck: LZ_decompress_read error: %s.\n",
fprintf( stderr, "lzcheck: LZ_decompress_read error: %s\n",
LZ_strerror( LZ_decompress_errno( decoder ) ) );
retval = 3; break;
}
@ -117,7 +117,7 @@ int lzcheck( FILE * const file, const int dictionary_size )
LZ_decompress_read( decoder, out_buffer, buffer_size ) != 0 ||
LZ_compress_restart_member( encoder, member_size ) < 0 )
{
fprintf( stderr, "lzcheck: Can't finish member: %s.\n",
fprintf( stderr, "lzcheck: Can't finish member: %s\n",
LZ_strerror( LZ_decompress_errno( decoder ) ) );
retval = 3;
}
@ -143,7 +143,7 @@ int lzcheck( FILE * const file, const int dictionary_size )
buffer_size - leading_garbage );
if( mid_size < 0 )
{
fprintf( stderr, "lzcheck: LZ_compress_read error: %s.\n",
fprintf( stderr, "lzcheck: LZ_compress_read error: %s\n",
LZ_strerror( LZ_compress_errno( encoder ) ) );
retval = 3; break;
}
@ -159,7 +159,7 @@ int lzcheck( FILE * const file, const int dictionary_size )
}
if( out_size < 0 )
{
fprintf( stderr, "lzcheck: LZ_decompress_read error: %s.\n",
fprintf( stderr, "lzcheck: LZ_decompress_read error: %s\n",
LZ_strerror( LZ_decompress_errno( decoder ) ) );
retval = 3; break;
}
@ -187,7 +187,7 @@ int lzcheck( FILE * const file, const int dictionary_size )
LZ_decompress_reset( decoder ) < 0 ||
LZ_compress_restart_member( encoder, member_size ) < 0 )
{
fprintf( stderr, "lzcheck: Can't restart member: %s.\n",
fprintf( stderr, "lzcheck: Can't restart member: %s\n",
LZ_strerror( LZ_decompress_errno( decoder ) ) );
retval = 3; break;
}
@ -200,7 +200,7 @@ int lzcheck( FILE * const file, const int dictionary_size )
LZ_decompress_sync_to_member( decoder ) < 0 ||
LZ_compress_restart_member( encoder, member_size ) < 0 )
{
fprintf( stderr, "lzcheck: Can't seek to next member: %s.\n",
fprintf( stderr, "lzcheck: Can't seek to next member: %s\n",
LZ_strerror( LZ_decompress_errno( decoder ) ) );
retval = 3; break;
}
@ -219,7 +219,7 @@ int main( const int argc, const char * const argv[] )
if( argc < 2 )
{
fprintf( stderr, "Usage: lzcheck filename.txt\n" );
fputs( "Usage: lzcheck filename.txt\n", stderr );
return 1;
}

16
lzlib.c
View file

@ -121,15 +121,15 @@ const char * LZ_strerror( const enum LZ_Errno lz_errno )
switch( lz_errno )
{
case LZ_ok : return "ok";
case LZ_bad_argument : return "bad argument";
case LZ_mem_error : return "not enough memory";
case LZ_sequence_error: return "sequence error";
case LZ_header_error : return "header error";
case LZ_unexpected_eof: return "unexpected eof";
case LZ_data_error : return "data error";
case LZ_library_error : return "library error";
case LZ_bad_argument : return "Bad argument";
case LZ_mem_error : return "Not enough memory";
case LZ_sequence_error: return "Sequence error";
case LZ_header_error : return "Header error";
case LZ_unexpected_eof: return "Unexpected eof";
case LZ_data_error : return "Data error";
case LZ_library_error : return "Library error";
}
return "invalid error code";
return "Invalid error code";
}

View file

@ -29,7 +29,7 @@
extern "C" {
#endif
static const char * const LZ_version_string = "1.7-rc1";
static const char * const LZ_version_string = "1.7";
enum LZ_Errno { LZ_ok = 0, LZ_bad_argument, LZ_mem_error,
LZ_sequence_error, LZ_header_error, LZ_unexpected_eof,

35
main.c
View file

@ -147,11 +147,10 @@ static void Pp_show_msg( struct Pretty_print * const pp, const char * const msg
{
if( pp->first_post )
{
int i, len;
int i, len = pp->longest_name - strlen( pp->name );
pp->first_post = false;
fprintf( stderr, " %s: ", pp->name );
len = pp->longest_name - strlen( pp->name );
for( i = 0; i < len; ++i ) fprintf( stderr, " " );
for( i = 0; i < len; ++i ) fputc( ' ', stderr );
if( !msg ) fflush( stderr );
}
if( msg ) fprintf( stderr, "%s\n", msg );
@ -170,7 +169,7 @@ static void show_help( void )
" -c, --stdout send output to standard output\n"
" -d, --decompress decompress\n"
" -f, --force overwrite existing output files\n"
" -F, --recompress force recompression of compressed files\n"
" -F, --recompress force re-compression of compressed files\n"
" -k, --keep keep (don't delete) input files\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"
@ -246,7 +245,7 @@ static unsigned long long getnum( const char * const ptr,
if( !errno && tail[0] )
{
int factor = ( tail[1] == 'i' ) ? 1024 : 1000;
const int factor = ( tail[1] == 'i' ) ? 1024 : 1000;
int exponent = 0, i;
bool bad_multiplier = false;
switch( tail[0] )
@ -296,7 +295,7 @@ static int get_dict_size( const char * const arg )
return ( 1 << bits );
dictionary_size = getnum( arg, LZ_min_dictionary_size(),
LZ_max_dictionary_size() );
if( dictionary_size == 65535 ) ++dictionary_size;
if( dictionary_size == 65535 ) ++dictionary_size; /* no fast encoder */
return dictionary_size;
}
@ -334,7 +333,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp
if( infd < 0 )
{
if( verbosity >= 0 )
fprintf( stderr, "%s: Can't open input file '%s': %s.\n",
fprintf( stderr, "%s: Can't open input file '%s': %s\n",
program_name, name, strerror( errno ) );
}
else
@ -351,7 +350,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp
fprintf( stderr, "%s: Input file '%s' is not a regular file%s.\n",
program_name, name,
( can_read && !no_ofile ) ?
" and '--stdout' was not specified" : "" );
",\n and '--stdout' was not specified" : "" );
close( infd );
infd = -1;
}
@ -405,7 +404,7 @@ static void set_d_outname( const char * const name, const int i )
strcpy( output_filename, name );
strcat( output_filename, ".out" );
if( verbosity >= 1 )
fprintf( stderr, "%s: Can't guess original name for '%s' -- using '%s'.\n",
fprintf( stderr, "%s: Can't guess original name for '%s' -- using '%s'\n",
program_name, name, output_filename );
}
@ -422,7 +421,7 @@ static bool open_outstream( const bool force )
fprintf( stderr, "%s: Output file '%s' already exists, skipping.\n",
program_name, output_filename );
else
fprintf( stderr, "%s: Can't create output file '%s': %s.\n",
fprintf( stderr, "%s: Can't create output file '%s': %s\n",
program_name, output_filename, strerror( errno ) );
}
return ( outfd >= 0 );
@ -578,7 +577,7 @@ static int do_compress( struct LZ_Encoder * const encoder,
{
Pp_show_msg( pp, 0 );
if( verbosity >= 0 )
fprintf( stderr, "%s: LZ_compress_read error: %s.\n",
fprintf( stderr, "%s: LZ_compress_read error: %s\n",
program_name, LZ_strerror( LZ_compress_errno( encoder ) ) );
return 1;
}
@ -619,7 +618,7 @@ static int do_compress( struct LZ_Encoder * const encoder,
{
Pp_show_msg( pp, 0 );
if( verbosity >= 0 )
fprintf( stderr, "%s: LZ_compress_restart_member error: %s.\n",
fprintf( stderr, "%s: LZ_compress_restart_member error: %s\n",
program_name, LZ_strerror( LZ_compress_errno( encoder ) ) );
return 1;
}
@ -631,7 +630,7 @@ static int do_compress( struct LZ_Encoder * const encoder,
const unsigned long long in_size = LZ_compress_total_in_size( encoder );
const unsigned long long out_size = LZ_compress_total_out_size( encoder );
if( in_size == 0 || out_size == 0 )
fprintf( stderr, " no data compressed.\n" );
fputs( " no data compressed.\n", stderr );
else
fprintf( stderr, "%6.3f:1, %6.3f bits/byte, "
"%5.2f%% saved, %llu in, %llu out.\n",
@ -729,7 +728,7 @@ static int do_decompress( struct LZ_Decoder * const decoder, const int infd,
fprintf( stderr, "data CRC %08X, data size %9llu, member size %8llu. ",
LZ_decompress_data_crc( decoder ),
data_position, member_size );
fprintf( stderr, testing ? "ok\n" : "done\n" );
fputs( testing ? "ok\n" : "done\n", stderr );
}
first_member = false; Pp_reset( pp );
}
@ -750,10 +749,10 @@ static int do_decompress( struct LZ_Decoder * const decoder, const int infd,
{
Pp_show_msg( pp, 0 );
if( lz_errno == LZ_unexpected_eof )
fprintf( stderr, "File ends unexpectedly at pos %llu.\n",
fprintf( stderr, "File ends unexpectedly at pos %llu\n",
LZ_decompress_total_in_size( decoder ) );
else
fprintf( stderr, "Decoder error at pos %llu: %s.\n",
fprintf( stderr, "Decoder error at pos %llu: %s\n",
LZ_decompress_total_in_size( decoder ),
LZ_strerror( LZ_decompress_errno( decoder ) ) );
}
@ -805,8 +804,8 @@ void show_error( const char * const msg, const int errcode, const bool help )
if( msg && msg[0] )
{
fprintf( stderr, "%s: %s", program_name, msg );
if( errcode > 0 ) fprintf( stderr, ": %s.", strerror( errcode ) );
fprintf( stderr, "\n" );
if( errcode > 0 ) fprintf( stderr, ": %s", strerror( errcode ) );
fputc( '\n', stderr );
}
if( help )
fprintf( stderr, "Try '%s --help' for more information.\n",

View file

@ -86,7 +86,6 @@ printf .
cat in in > in2 || framework_failure
"${LZIP}" -s16 -o copy2 < in2 || fail=1
"${LZIP}" -t copy2.lz || fail=1
printf .
"${LZIP}" -cd copy2.lz > copy2 || fail=1
cmp in2 copy2 || fail=1
printf .