summaryrefslogtreecommitdiffstats
path: root/merge.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 10:16:13 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 10:16:13 +0000
commitf8ec1a9b6de5ccde4220017676cbae1c16205fd1 (patch)
treec76650bdeec7078ff209e394b3d091bbbabb40f9 /merge.cc
parentAdding debian version 1.13~rc1-1. (diff)
downloadlziprecover-f8ec1a9b6de5ccde4220017676cbae1c16205fd1.tar.xz
lziprecover-f8ec1a9b6de5ccde4220017676cbae1c16205fd1.zip
Merging upstream version 1.13~rc2.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'merge.cc')
-rw-r--r--merge.cc25
1 files changed, 3 insertions, 22 deletions
diff --git a/merge.cc b/merge.cc
index 298d90b..4278fc0 100644
--- a/merge.cc
+++ b/merge.cc
@@ -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 ); }