Merging upstream version 0.23.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
513c27836a
commit
9745297ffe
39 changed files with 2213 additions and 1444 deletions
|
@ -24,12 +24,7 @@ struct Archive_descriptor
|
|||
const bool seekable;
|
||||
const bool indexed; // archive is a compressed regular file
|
||||
|
||||
Archive_descriptor( const std::string & archive_name )
|
||||
: name( archive_name ), namep( name.empty() ? "(stdin)" : name.c_str() ),
|
||||
infd( name.empty() ? STDIN_FILENO : open_instream( name ) ),
|
||||
lzip_index( infd, true, false ),
|
||||
seekable( lseek( infd, 0, SEEK_SET ) == 0 ),
|
||||
indexed( seekable && lzip_index.retval() == 0 ) {}
|
||||
Archive_descriptor( const std::string & archive_name );
|
||||
};
|
||||
|
||||
|
||||
|
@ -48,7 +43,8 @@ protected:
|
|||
int err( const int retval, const char * const msg = "", const int code = 0,
|
||||
const int size = 0, const bool skip = false )
|
||||
{ e_msg_ = msg; e_code_ = code; e_size_ = size; e_skip_ = skip;
|
||||
if( retval == 2 ) { fatal_ = true; } return retval; }
|
||||
if( retval >= 0 ) return retval;
|
||||
fatal_ = true; if( !*e_msg_ ) e_msg_ = "Fatal error"; return -retval; }
|
||||
|
||||
Archive_reader_base( const Archive_descriptor & d )
|
||||
: ad( d ), decoder( 0 ), e_msg_( "" ), e_code_( 0 ), e_size_( 0 ),
|
||||
|
@ -65,12 +61,13 @@ public:
|
|||
bool fatal() const { return fatal_; }
|
||||
|
||||
/* Read 'size' uncompressed bytes, decompressing the input if needed.
|
||||
Return value: 0 = OK, 1 = damaged member, 2 = fatal error.
|
||||
Return value: 0 = OK, 1 = OOM or read error, 2 = EOF or invalid data.
|
||||
If !OK, fills all the e_* variables. */
|
||||
virtual int read( uint8_t * const buf, const int size ) = 0;
|
||||
|
||||
int parse_records( Extended & extended, const Tar_header header,
|
||||
Resizable_buffer & rbuf, const bool permissive );
|
||||
Resizable_buffer & rbuf, const char * const default_msg,
|
||||
const bool permissive );
|
||||
};
|
||||
|
||||
|
||||
|
@ -96,7 +93,7 @@ public:
|
|||
*/
|
||||
class Archive_reader_i : public Archive_reader_base // indexed reader
|
||||
{
|
||||
long long data_pos_; // current decompressed position
|
||||
long long data_pos_; // current decompressed position in archive
|
||||
long long mdata_end_; // current member decompressed end
|
||||
long long archive_pos; // current position in archive for pread
|
||||
long member_id; // current member unless reading beyond
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue