diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | INSTALL | 3 | ||||
-rw-r--r-- | Makefile.in | 6 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | arg_parser.cc | 30 | ||||
-rw-r--r-- | arg_parser.h | 30 | ||||
-rw-r--r-- | compress.cc | 10 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | doc/plzip.1 | 6 | ||||
-rw-r--r-- | doc/plzip.info | 36 | ||||
-rw-r--r-- | doc/plzip.texi | 21 | ||||
-rw-r--r-- | lzip.h | 4 | ||||
-rw-r--r-- | main.cc | 23 |
13 files changed, 84 insertions, 94 deletions
@@ -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> * Version 1.4-pre1 released. @@ -1,9 +1,10 @@ Requirements ------------ 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. 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. Lzlib is available at http://www.nongnu.org/lzip/lzlib.html. diff --git a/Makefile.in b/Makefile.in index 542a989..1652cb6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,13 +20,13 @@ objs = arg_parser.o file_index.o compress.o dec_stdout.o dec_stream.o \ all : $(progname) $(progname) : $(objs) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(objs) $(LIBS) + $(CXX) $(LDFLAGS) $(CXXFLAGS) -o $@ $(objs) $(LIBS) main.o : main.cc - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $< + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $< %.o : %.cc - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< $(objs) : Makefile arg_parser.o : arg_parser.h @@ -1,5 +1,5 @@ Changes in version 1.4: 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. diff --git a/arg_parser.cc b/arg_parser.cc index 55764bd..551264a 100644 --- a/arg_parser.cc +++ b/arg_parser.cc @@ -1,28 +1,20 @@ /* Arg_parser - POSIX/GNU command line argument parser. (C++ version) Copyright (C) 2006-2015 Antonio Diaz Diaz. - This library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. + This library is free software. Redistribution and use in source and + binary forms, with or without modification, are permitted provided + that the following conditions are met: + + 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, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #include <cstring> diff --git a/arg_parser.h b/arg_parser.h index 2e8731c..3dc85d0 100644 --- a/arg_parser.h +++ b/arg_parser.h @@ -1,28 +1,20 @@ /* Arg_parser - POSIX/GNU command line argument parser. (C++ version) Copyright (C) 2006-2015 Antonio Diaz Diaz. - This library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 2 of the License, or - (at your option) any later version. + This library is free software. Redistribution and use in source and + binary forms, with or without modification, are permitted provided + that the following conditions are met: + + 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, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - 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. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /* Arg_parser reads the arguments in 'argv' and creates a number of diff --git a/compress.cc b/compress.cc index 424e090..1f0ae5d 100644 --- a/compress.cc +++ b/compress.cc @@ -251,7 +251,7 @@ public: xlock( &omutex ); // id collision shouldn't happen if( circular_buffer[i] != 0 ) - internal_error( "id collision in collect_packet" ); + internal_error( "id collision in collect_packet." ); // merge packet into circular buffer circular_buffer[i] = opacket; 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 ) pp( mem_msg ); else - internal_error( "invalid argument to encoder" ); + internal_error( "invalid argument to encoder." ); cleanup_and_fail(); } @@ -402,7 +402,7 @@ extern "C" void * cworker( void * arg ) const int wr = LZ_compress_write( encoder, packet->data + offset + 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; } if( written >= packet->size ) LZ_compress_finish( encoder ); @@ -419,7 +419,7 @@ extern "C" void * cworker( void * arg ) } new_pos += rd; 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; } @@ -542,6 +542,6 @@ int compress( const int data_size, const int dictionary_size, courier.ocheck_counter, courier.owait_counter ); - if( !courier.finished() ) internal_error( "courier not finished" ); + if( !courier.finished() ) internal_error( "courier not finished." ); return 0; } @@ -6,7 +6,7 @@ # to copy, distribute and modify it. pkgname=plzip -pkgversion=1.4-pre1 +pkgversion=1.4-rc1 progname=plzip srctrigger=doc/${pkgname}.texi diff --git a/doc/plzip.1 b/doc/plzip.1 index 9fb2220..6ed21c1 100644 --- a/doc/plzip.1 +++ b/doc/plzip.1 @@ -1,5 +1,5 @@ .\" 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 plzip \- reduces the size of files .SH SYNOPSIS @@ -16,7 +16,7 @@ display this help and exit output version information and exit .TP \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 \fB\-c\fR, \fB\-\-stdout\fR send output to standard output @@ -84,7 +84,7 @@ Plzip home page: http://www.nongnu.org/lzip/plzip.html Copyright \(co 2009 Laszlo Ersek. .br 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> .br This is free software: you are free to change and redistribute it. diff --git a/doc/plzip.info b/doc/plzip.info index e8bfe0d..d07ba9e 100644 --- a/doc/plzip.info +++ b/doc/plzip.info @@ -11,7 +11,7 @@ File: plzip.info, Node: Top, Next: Introduction, Up: (dir) 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: @@ -361,14 +361,12 @@ additional information before, between, or after them. now. 'DS (coded dictionary size, 1 byte)' - Lzip divides the distance between any two powers of 2 into 8 - equally spaced intervals, named "wedges". The dictionary size is - calculated by taking a power of 2 (the base size) and substracting - from it a number of wedges between 0 and 7. The size of a wedge is - (base_size / 16). + The dictionary size is calculated by taking a power of 2 (the base + size) and substracting from it a fraction between 0/16 and 7/16 of + the base size. 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. + Bits 7-5 contain the numerator of the fraction (0 to 7) to + substract from the base size to obtain the dictionary size. 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. @@ -400,10 +398,10 @@ The amount of memory required *per thread* is approximately the following: * 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 - 3 times the data size. + 3 times the data size. Default is 136 MiB. * For decompression of a regular (seekable) file to another regular file, or for testing of a regular file; the dictionary size. Note @@ -495,15 +493,15 @@ Concept index Tag Table: Node: Top221 -Node: Introduction994 -Node: Program design5291 -Node: Invoking plzip6880 -Ref: --data-size7294 -Node: File format12518 -Node: Memory requirements15061 -Node: Minimum file sizes16130 -Node: Problems18052 -Node: Concept index18588 +Node: Introduction988 +Node: Program design5285 +Node: Invoking plzip6874 +Ref: --data-size7288 +Node: File format12512 +Node: Memory requirements14925 +Node: Minimum file sizes16029 +Node: Problems17951 +Node: Concept index18487 End Tag Table diff --git a/doc/plzip.texi b/doc/plzip.texi index 1c2d42c..b501b9a 100644 --- a/doc/plzip.texi +++ b/doc/plzip.texi @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 25 February 2015 -@set VERSION 1.4-pre1 +@set UPDATED 23 May 2015 +@set VERSION 1.4-rc1 @dircategory Data Compression @direntry @@ -195,7 +195,7 @@ plzip [@var{options}] [@var{files}] Plzip supports the following options: -@table @samp +@table @code @item -h @itemx --help 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. @item DS (coded dictionary size, 1 byte) -Lzip divides the distance between any two powers of 2 into 8 equally -spaced intervals, named "wedges". The dictionary size is calculated by -taking a power of 2 (the base size) and substracting from it a number of -wedges between 0 and 7. The size of a wedge is (base_size / 16).@* +The dictionary size is calculated by taking a power of 2 (the base size) +and substracting from it a fraction between 0/16 and 7/16 of the base +size.@* 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.@* +Bits 7-5 contain the numerator of the fraction (0 to 7) to substract +from the base size to obtain the dictionary size.@* 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. @@ -440,11 +439,11 @@ following: @itemize @bullet @item 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 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 For decompression of a regular (seekable) file to another regular file, @@ -97,9 +97,9 @@ struct File_header if( sz > min_dictionary_size ) { 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 ) - if( base_size - ( i * wedge ) >= sz ) + if( base_size - ( i * fraction ) >= sz ) { data[5] |= ( i << 5 ); break; } } return true; @@ -103,7 +103,7 @@ void show_help( const long num_online ) std::printf( "\nOptions:\n" " -h, --help display this help 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" " -d, --decompress decompress\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 ) { char * tail; - int bits = std::strtol( arg, &tail, 0 ); + const int bits = std::strtol( arg, &tail, 0 ); if( bits >= LZ_min_dictionary_bits() && bits <= LZ_max_dictionary_bits() && *tail == 0 ) 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 ); if( !code ) break; /* no more options */ - const char * const arg = parser.argument( argind ).c_str(); + const std::string & arg = parser.argument( argind ); switch( code ) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': encoder_options = option_mapping[code-'0']; 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; case 'c': to_stdout = true; 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': recompress = true; break; case 'h': show_help( num_online ); return 0; case 'k': keep_input_files = true; break; case 'm': encoder_options.match_len_limit = - getnum( arg, LZ_min_match_len_limit(), - LZ_max_match_len_limit() ); break; - case 'n': num_workers = getnum( arg, 1, max_workers ); break; + getnum( arg.c_str(), LZ_min_match_len_limit(), + LZ_max_match_len_limit() ); break; + case 'n': num_workers = getnum( arg.c_str(), 1, max_workers ); break; case 'o': default_output_filename = arg; 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; case 'S': break; case 't': program_mode = m_test; break; |