From a499cf9dc12d64786b662483847c5eca56f78aca Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 7 Nov 2015 15:47:04 +0100 Subject: Merging upstream version 1.4~rc2. Signed-off-by: Daniel Baumann --- ChangeLog | 7 +++++++ INSTALL | 2 +- NEWS | 9 ++++++++- configure | 4 ++-- doc/pdlzip.1 | 7 ++++++- main.c | 34 +++++++++++++++++++--------------- 6 files changed, 43 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9214436..7d397bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-04-15 Antonio Diaz Diaz + + * Version 1.4-rc2 released. + * Fixed return value of '-d' and '-t' in case of data error. + * main.c: Changed info shown at verbosity levels 2 and 3. + * Ignore option '-n, --threads' for compatibility with plzip. + 2013-02-18 Antonio Diaz Diaz * Version 1.4-rc1 released. diff --git a/INSTALL b/INSTALL index feadbf6..3c4638a 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ Requirements ------------ You will need a C compiler. -I use gcc 4.7.2 and 3.3.6, but the code should compile with any +I use gcc 4.8.0 and 3.3.6, but the code should compile with any standards compliant compiler. Gcc is available at http://gcc.gnu.org. diff --git a/NEWS b/NEWS index fe9a4dd..e7a5fd2 100644 --- a/NEWS +++ b/NEWS @@ -7,9 +7,16 @@ Pdlzip now accepts more than one file in the command line. Decompression time has been reduced by 5%. -The dependence of "--test" on the existence of "/dev/null" has been +The dependence of "-t" on the existence of "/dev/null" has been removed. +The value returned by "-d" and "-t" in case of data error has been fixed. + +Information shown at verbosity levels 2 and 3 has been changed. + +Option "-n, --threads" is now accepted and ignored for compatibility +with plzip. + Configure option "--datadir" has been renamed to "--datarootdir" to follow GNU Standards. diff --git a/configure b/configure index a9f31cb..d22deae 100755 --- a/configure +++ b/configure @@ -8,9 +8,9 @@ args= no_create= pkgname=pdlzip -pkgversion=1.4-rc1 +pkgversion=1.4-rc2 progname=pdlzip -srctrigger=clzip.h +srctrigger=doc/pdlzip.1 # clear some things potentially inherited from environment. LC_ALL=C diff --git a/doc/pdlzip.1 b/doc/pdlzip.1 index 8833c31..cd9257e 100644 --- a/doc/pdlzip.1 +++ b/doc/pdlzip.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH PDLZIP "1" "February 2013" "Pdlzip 1.4-rc1" "User Commands" +.TH PDLZIP "1" "April 2013" "Pdlzip 1.4-rc2" "User Commands" .SH NAME Pdlzip \- reduces the size of files .SH SYNOPSIS @@ -66,6 +66,11 @@ 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. +.PP +Return values: 0 for a normal exit, 1 for environmental problems (file +not found, invalid flags, I/O errors, etc), 2 to indicate a corrupt or +invalid input file, 3 for an internal consistency error (eg, bug) which +caused pdlzip to panic. .SH "REPORTING BUGS" Report bugs to lzip\-bug@nongnu.org .br diff --git a/main.c b/main.c index cda4327..c2f3319 100644 --- a/main.c +++ b/main.c @@ -118,6 +118,10 @@ static void show_help( void ) "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" + "\nReturn values: 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" + "caused pdlzip to panic.\n" "\nReport bugs to lzip-bug@nongnu.org\n" "Pdlzip home page: http://www.nongnu.org/lzip/pdlzip.html\n" ); } @@ -163,8 +167,9 @@ void show_header( const File_header header ) for( i = 0; i < 8 && ( num > 9999 || ( exact && num >= factor ) ); ++i ) { num /= factor; if( num % factor != 0 ) exact = false; p = prefix[i]; np = ""; } - fprintf( stderr, "version %d, dictionary size %s%4u %sB. ", - Fh_version( header ), np, num, p ); + if( verbosity >= 4 ) + fprintf( stderr, "version %d, ", Fh_version( header ) ); + fprintf( stderr, "dictionary size %s%4u %sB. ", np, num, p ); } @@ -502,7 +507,7 @@ static int lzma_decode( uint64_t unpackSize, CLzmaDec *decoder, const int infd, if( !LzmaDec_DecodeToBuf( decoder, outBuf + outPos, &outProcessed, inBuf + *inPos, &inProcessed, finishMode, &status ) ) - { show_error( "Data error.", 0, false ); return 1; } + { show_error( "Data error.", 0, false ); return 2; } *inPos += inProcessed; total_in += inProcessed; outPos += outProcessed; @@ -519,7 +524,7 @@ static int lzma_decode( uint64_t unpackSize, CLzmaDec *decoder, const int infd, { if( ( thereIsSize && unpackSize != 0 ) || ( !thereIsSize && status != LZMA_STATUS_FINISHED_WITH_MARK ) ) - { show_error( "Data error.", 0, false ); return 1; } + { show_error( "Data error.", 0, false ); return 2; } if( verbosity >= 2 ) fprintf( stderr, "lzma-alone, dictionary size %7sB. ", format_num( decoder->dicBufSize ) ); @@ -527,8 +532,7 @@ static int lzma_decode( uint64_t unpackSize, CLzmaDec *decoder, const int infd, fprintf( stderr, "uncompressed size %9llu, compressed size %8llu. ", total_out, total_in ); if( verbosity >= 1 ) - { if( testing ) fprintf( stderr, "(apparently) ok\n" ); - else fprintf( stderr, "(apparently) done\n" ); } + fprintf( stderr, testing ? "(apparently) ok\n" : "(apparently) done\n" ); return 0; } } @@ -554,12 +558,12 @@ static int lzip_decode( CLzmaDec *decoder, const int infd, uint8_t inBuf[], if( *inPos >= *inSize && !read_inbuf( infd, inBuf, inPos, inSize ) ) return 1; if( *inPos >= *inSize ) - { show_error( "Unexpected EOF.", 0, false ); return 1; } + { show_error( "Unexpected EOF.", 0, false ); return 2; } inProcessed = *inSize - *inPos; if( !LzmaDec_DecodeToBuf( decoder, outBuf + outPos, &outProcessed, inBuf + *inPos, &inProcessed, finishMode, &status ) ) - { show_error( "Data error.", 0, false ); return 1; } + { show_error( "Data error.", 0, false ); return 2; } *inPos += inProcessed; total_in += inProcessed; outPos += outProcessed; @@ -579,7 +583,7 @@ static int lzip_decode( CLzmaDec *decoder, const int infd, uint8_t inBuf[], bool error = false; if( status != LZMA_STATUS_FINISHED_WITH_MARK ) - { show_error( "Data error.", 0, false ); return 1; } + { show_error( "Data error.", 0, false ); return 2; } if( *inSize - *inPos < trailer_size && !read_inbuf( infd, inBuf, inPos, inSize ) ) return 1; if( *inSize - *inPos < trailer_size ) @@ -617,7 +621,7 @@ static int lzip_decode( CLzmaDec *decoder, const int infd, uint8_t inBuf[], fprintf( stderr, "Member size mismatch; trailer says %llu, member size is %llu (0x%llX).\n", Ft_get_member_size( trailer ), total_in, total_in ); } - if( !error && verbosity >= 3 && total_out > 0 && total_in > 0 ) + if( !error && verbosity >= 2 && total_out > 0 && total_in > 0 ) fprintf( stderr, "%6.3f:1, %6.3f bits/byte, %5.2f%% saved. ", (double)total_out / total_in, ( 8.0 * total_in ) / total_out, @@ -701,7 +705,7 @@ static int decompress( const int infd, struct Pretty_print * const pp, if( verbosity >= 2 || ( verbosity == 1 && first_member ) ) { Pp_show_msg( pp, 0 ); - if( lzip_mode && verbosity >= 2 ) show_header( header ); + if( lzip_mode && verbosity >= 3 ) show_header( header ); } if( !LzmaDec_Init( &decoder, raw_props ) ) @@ -718,12 +722,10 @@ static int decompress( const int infd, struct Pretty_print * const pp, LzmaDec_Free(&decoder); if( retval != 0 || !lzip_mode ) break; if( verbosity >= 2 ) - { if( testing ) fprintf( stderr, "ok\n" ); - else fprintf( stderr, "done\n" ); Pp_reset( pp ); } + { fprintf( stderr, testing ? "ok\n" : "done\n" ); Pp_reset( pp ); } } if( lzip_mode && verbosity == 1 && retval == 0 ) - { if( testing ) fprintf( stderr, "ok\n" ); - else fprintf( stderr, "done\n" ); } + fprintf( stderr, testing ? "ok\n" : "done\n" ); return retval; } @@ -862,6 +864,7 @@ int main( const int argc, const char * const argv[] ) { 'h', "help", ap_no }, { 'k', "keep", ap_no }, { 'm', "match-length", ap_yes }, + { 'n', "threads", ap_yes }, { 'o', "output", ap_yes }, { 'q', "quiet", ap_no }, { 's', "dictionary-size", ap_yes }, @@ -901,6 +904,7 @@ int main( const int argc, const char * const argv[] ) case 'k': keep_input_files = true; break; case 'm': encoder_options.match_len_limit = getnum( arg, min_match_len_limit, max_match_len ); break; + case 'n': break; case 'o': default_output_filename = arg; break; case 'q': verbosity = -1; break; case 's': encoder_options.dictionary_size = get_dict_size( arg ); -- cgit v1.2.3