diff options
Diffstat (limited to 'merge.cc')
-rw-r--r-- | merge.cc | 25 |
1 files changed, 3 insertions, 22 deletions
@@ -34,24 +34,6 @@ namespace { -class Block - { - long long pos_, size_; // pos + size <= LLONG_MAX - -public: - Block( const long long p, const long long s ) throw() - : pos_( p ), size_( s ) {} - - long long pos() const throw() { return pos_; } - long long size() const throw() { return size_; } - long long end() const throw() { return pos_ + size_; } - - void pos( const long long p ) throw() { pos_ = p; } - void size( const long long s ) throw() { size_ = s; } - void shift( Block & b ) throw() { ++size_; ++b.pos_; --b.size_; } - }; - - bool copy_and_diff_file( const std::vector< int > & infd_vector, const int outfd, std::vector< Block > & block_vector ) { @@ -166,7 +148,7 @@ int open_input_files( const std::vector< std::string > & filenames, if( i == 0 ) { isize = tmp; - if( isize < 36 ) { show_error( "Input file is too short." ); return 2; } + if( isize < min_member_size ) { show_error( "Input file is too short." ); return 2; } } else if( isize != tmp ) { show_error( "Sizes of input files are different." ); return 1; } @@ -251,8 +233,7 @@ bool try_decompress( const int fd, const long long file_size, header.dictionary_size() <= max_dictionary_size ) { LZ_decoder decoder( header, rdec, -1 ); - std::vector< std::string > dummy_filenames; - Pretty_print dummy( dummy_filenames, -1 ); + Pretty_print dummy( "", -1 ); if( decoder.decode_member( dummy ) == 0 && rdec.member_position() == file_size ) return true; @@ -336,7 +317,7 @@ int merge_files( const std::vector< std::string > & filenames, if( !copy_and_diff_file( infd_vector, outfd, block_vector ) ) cleanup_and_fail( output_filename, outfd, 1 ); - if( !block_vector.size() ) + if( block_vector.size() == 0 ) { show_error( "Input files are identical. Recovery is not possible." ); cleanup_and_fail( output_filename, outfd, 2 ); } |