diff options
Diffstat (limited to '')
-rw-r--r-- | main.cc | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -89,8 +89,6 @@ struct Lzma_options }; enum Mode { m_compress, m_decompress, m_test }; -const unsigned long long max_member_size = 0x1000000000000000ULL; -const unsigned long long max_volume_size = 0x7FFFFFFFFFFFFFFFULL; std::string output_filename; int outfd = -1; @@ -130,7 +128,8 @@ void show_help() "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" @@ -163,7 +162,7 @@ void show_header( const File_header & header ) for( int i = 0; i < 8 && ( num > 9999 || ( exact && num >= factor ) ); ++i ) { num /= factor; if( num % factor != 0 ) exact = false; p = prefix[i]; np = ""; } - if( verbosity >= 4 ) + if( verbosity >= 4 && header.version() != 1 ) std::fprintf( stderr, "version %d, ", header.version() ); std::fprintf( stderr, "dictionary size %s%4u %sB. ", np, num, p ); } @@ -275,12 +274,13 @@ 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 ) ) ); - if( i != 0 || ( !S_ISREG( mode ) && ( !to_stdout || !can_read ) ) ) + const bool no_ofile = to_stdout || program_mode == m_test; + if( i != 0 || ( !S_ISREG( mode ) && ( !can_read || !no_ofile ) ) ) { if( verbosity >= 0 ) std::fprintf( stderr, "%s: Input file '%s' is not a regular file%s.\n", program_name, name, - ( can_read && !to_stdout ) ? + ( can_read && !no_ofile ) ? " and '--stdout' was not specified" : "" ); close( infd ); infd = -1; @@ -602,7 +602,7 @@ int decompress( const int infd, const Pretty_print & pp, const bool testing ) if( rdec.finished() ) // End Of File { if( first_member ) - { pp( "Error reading member header" ); retval = 1; } + { pp( "File ends unexpectedly at member header" ); retval = 2; } else if( verbosity >= 4 && size > 0 ) show_trailing_garbage( header.data, size, pp, true ); break; @@ -754,6 +754,8 @@ int main( const int argc, const char * const argv[] ) { 3 << 23, 132 }, // -8 { 1 << 25, 273 } }; // -9 Lzma_options encoder_options = option_mapping[6]; // default = "-6" + const unsigned long long max_member_size = 0x0100000000000000ULL; + const unsigned long long max_volume_size = 0x4000000000000000ULL; unsigned long long member_size = max_member_size; unsigned long long volume_size = 0; std::string input_filename; |