Merging upstream version 1.13~rc1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
f40403d840
commit
95e3ee3bd3
29 changed files with 472 additions and 517 deletions
33
zcmpdiff.cc
33
zcmpdiff.cc
|
@ -31,21 +31,26 @@ int open_instream( const std::string & input_filename )
|
|||
|
||||
int open_other_instream( std::string & name )
|
||||
{
|
||||
const int eindex = extension_index( name );
|
||||
if( eindex >= 0 && enabled_format( -1 ) )
|
||||
{ // open uncompressed version
|
||||
name.resize( name.size() - std::strlen( extension_from( eindex ) ) );
|
||||
name += extension_to( eindex );
|
||||
return open( name.c_str(), O_RDONLY | O_BINARY );
|
||||
const int eindex = extension_index( name ); // search extension
|
||||
if( eindex >= 0 && enabled_format( -1 ) ) // open uncompressed version
|
||||
{
|
||||
std::string s( name, 0, name.size() - std::strlen( extension_from( eindex ) ) );
|
||||
s += extension_to( eindex );
|
||||
const int infd = open( s.c_str(), O_RDONLY | O_BINARY );
|
||||
if( infd >= 0 ) { name = s; return infd; }
|
||||
}
|
||||
const int eformat = extension_format( eindex );
|
||||
for( int i = 0; i < num_formats; ++i ) // search compressed version
|
||||
{
|
||||
const int format_index = format_order[i];
|
||||
if( eformat != format_index && enabled_format( format_index ) )
|
||||
{
|
||||
std::string s( name, 0, name.size() - std::strlen( extension_from( eindex ) ) );
|
||||
s += simple_extensions[format_index];
|
||||
const int infd = open( s.c_str(), O_RDONLY | O_BINARY );
|
||||
if( infd >= 0 ) { name = s; return infd; }
|
||||
}
|
||||
}
|
||||
if( eindex < 0 ) // search compressed version
|
||||
for( int i = 0; i < num_formats; ++i )
|
||||
if( enabled_format( format_order[i] ) )
|
||||
{
|
||||
const std::string s( name + simple_extensions[format_order[i]] );
|
||||
const int infd = open( s.c_str(), O_RDONLY | O_BINARY );
|
||||
if( infd >= 0 ) { name = s; return infd; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue