1
0
Fork 0

Adding upstream version 1.13~rc2.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-21 10:12:24 +01:00
parent 89ca1f7591
commit 7fe0f13dd3
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
17 changed files with 679 additions and 132 deletions

View file

@ -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 ); }