1
0
Fork 0

Adding upstream version 1.4~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 04:08:54 +01:00
parent 8473fa783f
commit 06af02d828
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
13 changed files with 84 additions and 94 deletions

View file

@ -1,3 +1,8 @@
2015-05-23 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.4-rc1 released.
* Show default '--data-size' in '--help' output.
2015-02-25 Antonio Diaz Diaz <antonio@gnu.org> 2015-02-25 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.4-pre1 released. * Version 1.4-pre1 released.

View file

@ -1,9 +1,10 @@
Requirements Requirements
------------ ------------
You will need a C++ compiler and the lzlib compression library installed. You will need a C++ compiler and the lzlib compression library installed.
I use gcc 4.9.1 and 3.3.6, but the code should compile with any I use gcc 4.9.1 and 4.1.2, but the code should compile with any
standards compliant compiler. standards compliant compiler.
Lzlib must be version 1.0 or newer. Lzlib must be version 1.0 or newer.
The fast encoder is only available in lzlib 1.7-pre1 or newer.
Gcc is available at http://gcc.gnu.org. Gcc is available at http://gcc.gnu.org.
Lzlib is available at http://www.nongnu.org/lzip/lzlib.html. Lzlib is available at http://www.nongnu.org/lzip/lzlib.html.

View file

@ -20,13 +20,13 @@ objs = arg_parser.o file_index.o compress.o dec_stdout.o dec_stream.o \
all : $(progname) all : $(progname)
$(progname) : $(objs) $(progname) : $(objs)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(objs) $(LIBS) $(CXX) $(LDFLAGS) $(CXXFLAGS) -o $@ $(objs) $(LIBS)
main.o : main.cc main.o : main.cc
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $< $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $<
%.o : %.cc %.o : %.cc
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
$(objs) : Makefile $(objs) : Makefile
arg_parser.o : arg_parser.h arg_parser.o : arg_parser.h

2
NEWS
View file

@ -1,5 +1,5 @@
Changes in version 1.4: Changes in version 1.4:
The option "-0" has been modified to use the new fast encoder of lzlib The option "-0" has been modified to use the new fast encoder of lzlib
1.7-pre1, achieving a compression speed and ratio comparable to those of 1.7, achieving a compression speed and ratio comparable to those of
pigz's default compression level. pigz's default compression level.

View file

@ -1,28 +1,20 @@
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version) /* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
Copyright (C) 2006-2015 Antonio Diaz Diaz. Copyright (C) 2006-2015 Antonio Diaz Diaz.
This library is free software: you can redistribute it and/or modify This library is free software. Redistribution and use in source and
it under the terms of the GNU General Public License as published by binary forms, with or without modification, are permitted provided
the Free Software Foundation, either version 2 of the License, or that the following conditions are met:
(at your option) any later version.
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library. If not, see <http://www.gnu.org/licenses/>.
As a special exception, you may use this file as part of a free
software library without restriction. Specifically, if other files
instantiate templates or use macros or inline functions from this
file, or you compile this file and link it with other files to
produce an executable, this file does not by itself cause the
resulting executable to be covered by the GNU General Public
License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General
Public License.
*/ */
#include <cstring> #include <cstring>

View file

@ -1,28 +1,20 @@
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version) /* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
Copyright (C) 2006-2015 Antonio Diaz Diaz. Copyright (C) 2006-2015 Antonio Diaz Diaz.
This library is free software: you can redistribute it and/or modify This library is free software. Redistribution and use in source and
it under the terms of the GNU General Public License as published by binary forms, with or without modification, are permitted provided
the Free Software Foundation, either version 2 of the License, or that the following conditions are met:
(at your option) any later version.
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library. If not, see <http://www.gnu.org/licenses/>.
As a special exception, you may use this file as part of a free
software library without restriction. Specifically, if other files
instantiate templates or use macros or inline functions from this
file, or you compile this file and link it with other files to
produce an executable, this file does not by itself cause the
resulting executable to be covered by the GNU General Public
License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General
Public License.
*/ */
/* Arg_parser reads the arguments in 'argv' and creates a number of /* Arg_parser reads the arguments in 'argv' and creates a number of

View file

@ -251,7 +251,7 @@ public:
xlock( &omutex ); xlock( &omutex );
// id collision shouldn't happen // id collision shouldn't happen
if( circular_buffer[i] != 0 ) if( circular_buffer[i] != 0 )
internal_error( "id collision in collect_packet" ); internal_error( "id collision in collect_packet." );
// merge packet into circular buffer // merge packet into circular buffer
circular_buffer[i] = opacket; circular_buffer[i] = opacket;
if( opacket->id == deliver_id ) xsignal( &oav_or_exit ); if( opacket->id == deliver_id ) xsignal( &oav_or_exit );
@ -387,7 +387,7 @@ extern "C" void * cworker( void * arg )
if( !encoder || LZ_compress_errno( encoder ) == LZ_mem_error ) if( !encoder || LZ_compress_errno( encoder ) == LZ_mem_error )
pp( mem_msg ); pp( mem_msg );
else else
internal_error( "invalid argument to encoder" ); internal_error( "invalid argument to encoder." );
cleanup_and_fail(); cleanup_and_fail();
} }
@ -402,7 +402,7 @@ extern "C" void * cworker( void * arg )
const int wr = LZ_compress_write( encoder, const int wr = LZ_compress_write( encoder,
packet->data + offset + written, packet->data + offset + written,
packet->size - written ); packet->size - written );
if( wr < 0 ) internal_error( "library error (LZ_compress_write)" ); if( wr < 0 ) internal_error( "library error (LZ_compress_write)." );
written += wr; written += wr;
} }
if( written >= packet->size ) LZ_compress_finish( encoder ); if( written >= packet->size ) LZ_compress_finish( encoder );
@ -419,7 +419,7 @@ extern "C" void * cworker( void * arg )
} }
new_pos += rd; new_pos += rd;
if( new_pos >= offset + written ) if( new_pos >= offset + written )
internal_error( "packet size exceeded in worker" ); internal_error( "packet size exceeded in worker." );
if( LZ_compress_finished( encoder ) == 1 ) break; if( LZ_compress_finished( encoder ) == 1 ) break;
} }
@ -542,6 +542,6 @@ int compress( const int data_size, const int dictionary_size,
courier.ocheck_counter, courier.ocheck_counter,
courier.owait_counter ); courier.owait_counter );
if( !courier.finished() ) internal_error( "courier not finished" ); if( !courier.finished() ) internal_error( "courier not finished." );
return 0; return 0;
} }

2
configure vendored
View file

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

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
.TH PLZIP "1" "February 2015" "plzip 1.4-pre1" "User Commands" .TH PLZIP "1" "May 2015" "plzip 1.4-rc1" "User Commands"
.SH NAME .SH NAME
plzip \- reduces the size of files plzip \- reduces the size of files
.SH SYNOPSIS .SH SYNOPSIS
@ -16,7 +16,7 @@ display this help and exit
output version information and exit output version information and exit
.TP .TP
\fB\-B\fR, \fB\-\-data\-size=\fR<bytes> \fB\-B\fR, \fB\-\-data\-size=\fR<bytes>
set size of input data blocks, in bytes set size of input data blocks [2x8=16 MiB]
.TP .TP
\fB\-c\fR, \fB\-\-stdout\fR \fB\-c\fR, \fB\-\-stdout\fR
send output to standard output send output to standard output
@ -84,7 +84,7 @@ Plzip home page: http://www.nongnu.org/lzip/plzip.html
Copyright \(co 2009 Laszlo Ersek. Copyright \(co 2009 Laszlo Ersek.
.br .br
Copyright \(co 2015 Antonio Diaz Diaz. Copyright \(co 2015 Antonio Diaz Diaz.
Using Lzlib 1.7\-pre1 Using Lzlib 1.7\-rc1
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> License GPLv2+: GNU GPL version 2 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

@ -11,7 +11,7 @@ File: plzip.info, Node: Top, Next: Introduction, Up: (dir)
Plzip Manual Plzip Manual
************ ************
This manual is for Plzip (version 1.4-pre1, 25 February 2015). This manual is for Plzip (version 1.4-rc1, 23 May 2015).
* Menu: * Menu:
@ -361,14 +361,12 @@ additional information before, between, or after them.
now. now.
'DS (coded dictionary size, 1 byte)' 'DS (coded dictionary size, 1 byte)'
Lzip divides the distance between any two powers of 2 into 8 The dictionary size is calculated by taking a power of 2 (the base
equally spaced intervals, named "wedges". The dictionary size is size) and substracting from it a fraction between 0/16 and 7/16 of
calculated by taking a power of 2 (the base size) and substracting the base size.
from it a number of 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 Bits 7-5 contain the numerator of the fraction (0 to 7) to
the base size to obtain the dictionary size. substract from the base size to obtain the dictionary size.
Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB 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. Valid values for dictionary size range from 4 KiB to 512 MiB.
@ -400,10 +398,10 @@ The amount of memory required *per thread* is approximately the
following: following:
* For compression at level -0; 1.5 MiB plus 3 times the data size * For compression at level -0; 1.5 MiB plus 3 times the data size
(*note --data-size::). (*note --data-size::). About 4.5 MiB.
* For compression at other levels; 11 times the dictionary size plus * For compression at other levels; 11 times the dictionary size plus
3 times the data size. 3 times the data size. Default is 136 MiB.
* For decompression of a regular (seekable) file to another regular * For decompression of a regular (seekable) file to another regular
file, or for testing of a regular file; the dictionary size. Note file, or for testing of a regular file; the dictionary size. Note
@ -495,15 +493,15 @@ Concept index
 
Tag Table: Tag Table:
Node: Top221 Node: Top221
Node: Introduction994 Node: Introduction988
Node: Program design5291 Node: Program design5285
Node: Invoking plzip6880 Node: Invoking plzip6874
Ref: --data-size7294 Ref: --data-size7288
Node: File format12518 Node: File format12512
Node: Memory requirements15061 Node: Memory requirements14925
Node: Minimum file sizes16130 Node: Minimum file sizes16029
Node: Problems18052 Node: Problems17951
Node: Concept index18588 Node: Concept index18487
 
End Tag Table End Tag Table

View file

@ -6,8 +6,8 @@
@finalout @finalout
@c %**end of header @c %**end of header
@set UPDATED 25 February 2015 @set UPDATED 23 May 2015
@set VERSION 1.4-pre1 @set VERSION 1.4-rc1
@dircategory Data Compression @dircategory Data Compression
@direntry @direntry
@ -195,7 +195,7 @@ plzip [@var{options}] [@var{files}]
Plzip supports the following options: Plzip supports the following options:
@table @samp @table @code
@item -h @item -h
@itemx --help @itemx --help
Print an informative help message describing the options and exit. Print an informative help message describing the options and exit.
@ -394,13 +394,12 @@ A four byte string, identifying the lzip format, with the value "LZIP"
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.
@item DS (coded dictionary size, 1 byte) @item DS (coded dictionary size, 1 byte)
Lzip divides the distance between any two powers of 2 into 8 equally The dictionary size is calculated by taking a power of 2 (the base size)
spaced intervals, named "wedges". The dictionary size is calculated by and substracting from it a fraction between 0/16 and 7/16 of the base
taking a power of 2 (the base size) and substracting from it a number of size.@*
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 numerator of the fraction (0 to 7) to substract
base size to obtain the dictionary size.@* from the base size to obtain the dictionary size.@*
Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB@* 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. Valid values for dictionary size range from 4 KiB to 512 MiB.
@ -440,11 +439,11 @@ following:
@itemize @bullet @itemize @bullet
@item @item
For compression at level -0; 1.5 MiB plus 3 times the data size For compression at level -0; 1.5 MiB plus 3 times the data size
(@pxref{--data-size}). (@pxref{--data-size}). About 4.5 MiB.
@item @item
For compression at other levels; 11 times the dictionary size plus 3 For compression at other levels; 11 times the dictionary size plus 3
times the data size. times the data size. Default is 136 MiB.
@item @item
For decompression of a regular (seekable) file to another regular file, For decompression of a regular (seekable) file to another regular file,

4
lzip.h
View file

@ -97,9 +97,9 @@ struct File_header
if( sz > min_dictionary_size ) if( sz > min_dictionary_size )
{ {
const unsigned base_size = 1 << data[5]; const unsigned base_size = 1 << data[5];
const unsigned wedge = base_size / 16; const unsigned fraction = base_size / 16;
for( int i = 7; i >= 1; --i ) for( int i = 7; i >= 1; --i )
if( base_size - ( i * wedge ) >= sz ) if( base_size - ( i * fraction ) >= sz )
{ data[5] |= ( i << 5 ); break; } { data[5] |= ( i << 5 ); break; }
} }
return true; return true;

23
main.cc
View file

@ -103,7 +103,7 @@ void show_help( const long num_online )
std::printf( "\nOptions:\n" std::printf( "\nOptions:\n"
" -h, --help display this help and exit\n" " -h, --help display this help and exit\n"
" -V, --version output version information and exit\n" " -V, --version output version information and exit\n"
" -B, --data-size=<bytes> set size of input data blocks, in bytes\n" " -B, --data-size=<bytes> set size of input data blocks [2x8=16 MiB]\n"
" -c, --stdout send output to standard output\n" " -c, --stdout send output to standard output\n"
" -d, --decompress decompress\n" " -d, --decompress decompress\n"
" -f, --force overwrite existing output files\n" " -f, --force overwrite existing output files\n"
@ -232,11 +232,14 @@ unsigned long long getnum( const char * const ptr,
int get_dict_size( const char * const arg ) int get_dict_size( const char * const arg )
{ {
char * tail; char * tail;
int bits = std::strtol( arg, &tail, 0 ); const int bits = std::strtol( arg, &tail, 0 );
if( bits >= LZ_min_dictionary_bits() && if( bits >= LZ_min_dictionary_bits() &&
bits <= LZ_max_dictionary_bits() && *tail == 0 ) bits <= LZ_max_dictionary_bits() && *tail == 0 )
return ( 1 << bits ); return ( 1 << bits );
return getnum( arg, LZ_min_dictionary_size(), LZ_max_dictionary_size() ); int dictionary_size = getnum( arg, LZ_min_dictionary_size(),
LZ_max_dictionary_size() );
if( dictionary_size == 65535 ) ++dictionary_size;
return dictionary_size;
} }
@ -585,29 +588,29 @@ int main( const int argc, const char * const argv[] )
{ {
const int code = parser.code( argind ); const int code = parser.code( argind );
if( !code ) break; /* no more options */ if( !code ) break; /* no more options */
const char * const arg = parser.argument( argind ).c_str(); const std::string & arg = parser.argument( argind );
switch( code ) switch( code )
{ {
case '0': case '1': case '2': case '3': case '4': case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
encoder_options = option_mapping[code-'0']; break; encoder_options = option_mapping[code-'0']; break;
case 'b': break; case 'b': break;
case 'B': data_size = getnum( arg, 2 * LZ_min_dictionary_size(), case 'B': data_size = getnum( arg.c_str(), 2 * LZ_min_dictionary_size(),
2 * LZ_max_dictionary_size() ); break; 2 * LZ_max_dictionary_size() ); break;
case 'c': to_stdout = true; break; case 'c': to_stdout = true; break;
case 'd': program_mode = m_decompress; break; case 'd': program_mode = m_decompress; break;
case 'D': debug_level = getnum( arg, 0, 3 ); break; case 'D': debug_level = getnum( arg.c_str(), 0, 3 ); break;
case 'f': force = true; break; case 'f': force = true; break;
case 'F': recompress = true; break; case 'F': recompress = true; break;
case 'h': show_help( num_online ); return 0; case 'h': show_help( num_online ); return 0;
case 'k': keep_input_files = true; break; case 'k': keep_input_files = true; break;
case 'm': encoder_options.match_len_limit = case 'm': encoder_options.match_len_limit =
getnum( arg, LZ_min_match_len_limit(), getnum( arg.c_str(), LZ_min_match_len_limit(),
LZ_max_match_len_limit() ); break; LZ_max_match_len_limit() ); break;
case 'n': num_workers = getnum( arg, 1, max_workers ); break; case 'n': num_workers = getnum( arg.c_str(), 1, max_workers ); break;
case 'o': default_output_filename = arg; break; case 'o': default_output_filename = arg; break;
case 'q': verbosity = -1; break; case 'q': verbosity = -1; break;
case 's': encoder_options.dictionary_size = get_dict_size( arg ); case 's': encoder_options.dictionary_size = get_dict_size( arg.c_str() );
break; break;
case 'S': break; case 'S': break;
case 't': program_mode = m_test; break; case 't': program_mode = m_test; break;