Adding upstream version 0.14.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ab822ce17b
commit
be936e5cc3
21 changed files with 795 additions and 265 deletions
20
extended.cc
20
extended.cc
|
@ -201,7 +201,9 @@ bool Extended::parse( const char * const buf, const unsigned long long edsize,
|
|||
if( rest > 5 && std::memcmp( tail, "path=", 5 ) == 0 )
|
||||
{
|
||||
if( path_.size() && !permissive ) return false;
|
||||
path_.assign( tail + 5, rest - 5 );
|
||||
unsigned long long len = rest - 5;
|
||||
while( len > 1 && tail[5+len-1] == '/' ) --len; // trailing '/'
|
||||
path_.assign( tail + 5, len );
|
||||
// this also truncates path_ at the first embedded null character
|
||||
path_.assign( remove_leading_dotslash( path_.c_str() ) );
|
||||
}
|
||||
|
@ -275,3 +277,19 @@ void Extended::fill_from_ustar( const Tar_header header )
|
|||
( typeflag == tf_regular || typeflag == tf_hiperf ) )
|
||||
file_size( parse_octal( header + size_o, size_l ) );
|
||||
}
|
||||
|
||||
|
||||
/* Returns file size from record or from ustar header, and resets file_size_.
|
||||
Used for fast parsing of headers in uncompressed archives. */
|
||||
unsigned long long Extended::get_file_size_and_reset( const Tar_header header )
|
||||
{
|
||||
const unsigned long long tmp = file_size_;
|
||||
file_size( 0 );
|
||||
const Typeflag typeflag = (Typeflag)header[typeflag_o];
|
||||
if( typeflag == tf_regular || typeflag == tf_hiperf )
|
||||
{
|
||||
if( tmp == 0 ) return parse_octal( header + size_o, size_l );
|
||||
else return tmp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue