1
0
Fork 0

Adding upstream version 1.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 04:01:44 +01:00
parent e7c68f81ff
commit 2680698e3e
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
10 changed files with 52 additions and 46 deletions

View file

@ -1,6 +1,6 @@
2013-07-20 Antonio Diaz Diaz <antonio@gnu.org>
2013-09-17 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.1-pre1 released.
* Version 1.1 released.
* Show progress of compression at verbosity level 2 (-vv).
* SIGUSR1 and SIGUSR2 are no more used to signal a fatal error.

View file

@ -49,8 +49,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

View file

@ -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 "--"

2
configure vendored
View file

@ -6,7 +6,7 @@
# to copy, distribute and modify it.
pkgname=plzip
pkgversion=1.1-pre1
pkgversion=1.1
progname=plzip
srctrigger=doc/${pkgname}.texinfo

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
.TH PLZIP "1" "July 2013" "Plzip 1.1-pre1" "User Commands"
.TH PLZIP "1" "September 2013" "Plzip 1.1" "User Commands"
.SH NAME
Plzip \- reduces the size of files
.SH SYNOPSIS
@ -46,7 +46,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\-t\fR, \fB\-\-test\fR
test compressed file integrity
@ -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
@ -84,7 +85,7 @@ Plzip home page: http://www.nongnu.org/lzip/plzip.html
Copyright \(co 2009 Laszlo Ersek.
.br
Copyright \(co 2013 Antonio Diaz Diaz.
Using Lzlib 1.4
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.

View file

@ -12,7 +12,7 @@ File: plzip.info, Node: Top, Next: Introduction, Up: (dir)
Plzip Manual
************
This manual is for Plzip (version 1.1-pre1, 20 July 2013).
This manual is for Plzip (version 1.1, 17 September 2013).
* Menu:
@ -149,8 +149,8 @@ The format for running plzip is:
`--data-size=BYTES'
Set the input data block size in bytes. The input file will be
divided in chunks of this size before compression is performed.
Valid values range from 8KiB to 1GiB. Default value is two times
the dictionary size. Plzip will reduce the dictionary size if it
Valid values range from 8 KiB to 1 GiB. Default value is two times
the dictionary size. Plzip will reduce the dictionary size if it
is larger than the chosen data size.
`-c'
@ -204,8 +204,8 @@ The format for running plzip is:
`-s BYTES'
`--dictionary-size=BYTES'
Set the dictionary size limit in bytes. Valid values range from
4KiB to 512MiB. Plzip will use the smallest possible dictionary
Set the dictionary size limit in bytes. Valid values range from 4
KiB to 512 MiB. Plzip will use the smallest possible dictionary
size for each member without exceeding this limit. 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
@ -241,7 +241,8 @@ The format for running plzip is:
linear scale optimal for all files. If your files are large, very
repetitive, etc, you may need to use the `--match-length' and
`--dictionary-size' options directly to achieve optimal
performance.
performance. For example, `-9m64' usually compresses executables
more (and faster) than `-9'.
Level Dictionary size Match length limit
-1 1 MiB 5 bytes
@ -259,7 +260,6 @@ The format for running plzip is:
Aliases for GNU gzip compatibility.
Numbers given as arguments to options may be followed by a multiplier
and an optional `B' for "byte".
@ -318,7 +318,7 @@ 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
@ -333,8 +333,8 @@ 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
@ -357,7 +357,7 @@ additional information before, between, or after them.

File: plzip.info, Node: Problems, Next: Concept index, Prev: File format, Up: Top
5 Reporting Bugs
5 Reporting bugs
****************
There are probably bugs in plzip. There are certainly errors and
@ -395,9 +395,9 @@ Node: Top223
Node: Introduction871
Node: Program design4426
Node: Invoking plzip5480
Node: File format10776
Node: Problems13255
Node: Concept index13784
Node: File format10864
Node: Problems13369
Node: Concept index13898

End Tag Table

View file

@ -6,8 +6,8 @@
@finalout
@c %**end of header
@set UPDATED 20 July 2013
@set VERSION 1.1-pre1
@set UPDATED 17 September 2013
@set VERSION 1.1
@dircategory Data Compression
@direntry
@ -173,9 +173,9 @@ Print the version number of plzip on the standard output and exit.
@itemx --data-size=@var{bytes}
Set the input data block size in bytes. The input file will be divided
in chunks of this size before compression is performed. Valid values
range from 8KiB to 1GiB. Default value is two times the dictionary size.
Plzip will reduce the dictionary size if it is larger than the chosen
data size.
range from 8 KiB to 1 GiB. Default value is two times the dictionary
size. Plzip will reduce the dictionary size if it is larger than the
chosen data size.
@item -c
@itemx --stdout
@ -225,8 +225,8 @@ Quiet operation. Suppress all messages.
@item -s @var{bytes}
@itemx --dictionary-size=@var{bytes}
Set the dictionary size limit in bytes. Valid values range from 4KiB to
512MiB. Plzip will use the smallest possible dictionary size for each
Set the dictionary size limit in bytes. Valid values range from 4 KiB to
512 MiB. Plzip will use the smallest possible dictionary size for each
member without exceeding this limit. 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{bytes} / 16) to it.
@ -259,7 +259,8 @@ 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 @samp{--match-length} and
@samp{--dictionary-size} options directly to achieve optimal
performance.
performance. For example, @samp{-9m64} usually compresses executables
more (and faster) than @samp{-9}.
@multitable {Level} {Dictionary size} {Match length limit}
@item Level @tab Dictionary size @tab Match length limit
@ -280,7 +281,6 @@ Aliases for GNU gzip compatibility.
@end table
@sp 1
Numbers given as arguments to options may be followed by a multiplier
and an optional @samp{B} for "byte".
@ -346,7 +346,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.
@ -359,8 +360,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
@ -381,7 +382,7 @@ facilitates safe recovery of undamaged members from multi-member files.
@node Problems
@chapter Reporting Bugs
@chapter Reporting bugs
@cindex bugs
@cindex getting help

6
lzip.h
View file

@ -89,15 +89,15 @@ struct File_header
return sz;
}
bool dictionary_size( const int sz )
bool dictionary_size( const unsigned sz )
{
if( sz >= min_dictionary_size && sz <= max_dictionary_size )
{
data[5] = real_bits( sz - 1 );
if( sz > min_dictionary_size )
{
const int base_size = 1 << data[5];
const int wedge = base_size / 16;
const unsigned base_size = 1 << data[5];
const unsigned wedge = base_size / 16;
for( int i = 7; i >= 1; --i )
if( base_size - ( i * wedge ) >= sz )
{ data[5] |= ( i << 5 ); break; }

11
main.cc
View file

@ -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 };
@ -115,7 +115,7 @@ void show_help( const long num_online )
" -n, --threads=<n> set number of (de)compression threads [%ld]\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"
" -t, --test test compressed file integrity\n"
" -v, --verbose be verbose (a 2nd -v gives more)\n"
" -1 .. -9 set compression level [default 6]\n"
@ -132,7 +132,8 @@ void show_help( const long num_online )
"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"
@ -260,7 +261,7 @@ int open_instream( const char * const name, struct stat * const in_statsp,
const bool can_read = ( i == 0 &&
( S_ISBLK( mode ) || S_ISCHR( mode ) ||
S_ISFIFO( mode ) || S_ISSOCK( mode ) ) );
const bool no_ofile = to_stdout || ( program_mode == m_test );
const bool no_ofile = to_stdout || program_mode == m_test;
if( i != 0 || ( !S_ISREG( mode ) && ( !can_read || !no_ofile ) ) )
{
if( verbosity >= 0 )

View file

@ -43,6 +43,10 @@ if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
"${LZIP}" -cdq < in
if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
dd if="${in_lz}" bs=1 count=6 2> /dev/null | "${LZIP}" -tq
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
dd if="${in_lz}" bs=1 count=20 2> /dev/null | "${LZIP}" -tq
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${LZIP}" -t "${in_lz}" || fail=1
"${LZIP}" -cd "${in_lz}" > copy || fail=1