summaryrefslogtreecommitdiffstats
path: root/lzip_index.h
diff options
context:
space:
mode:
Diffstat (limited to 'lzip_index.h')
-rw-r--r--lzip_index.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/lzip_index.h b/lzip_index.h
index 0b8ace1..52d831e 100644
--- a/lzip_index.h
+++ b/lzip_index.h
@@ -1,5 +1,5 @@
/* Lziprecover - Data recovery tool for the lzip format
- Copyright (C) 2009-2022 Antonio Diaz Diaz.
+ Copyright (C) 2009-2023 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,9 +22,11 @@ class Lzip_index
Block dblock, mblock; // data block, member block
unsigned dictionary_size;
- Member( const long long dp, const long long ds,
- const long long mp, const long long ms, const unsigned dict_size )
- : dblock( dp, ds ), mblock( mp, ms ), dictionary_size( dict_size ) {}
+ Member( const long long dpos, const long long dsize,
+ const long long mpos, const long long msize,
+ const unsigned dict_size )
+ : dblock( dpos, dsize ), mblock( mpos, msize ),
+ dictionary_size( dict_size ) {}
bool operator==( const Member & m ) const { return ( mblock == m.mblock ); }
bool operator!=( const Member & m ) const { return ( mblock != m.mblock ); }
@@ -37,24 +39,27 @@ class Lzip_index
long long insize;
int retval_;
unsigned dictionary_size_; // largest dictionary size in the file
+ bool bad_magic_; // bad magic in first header
- bool check_header_error( const Lzip_header & header,
+ bool check_header_error( const Lzip_header & header, const bool first,
const bool ignore_bad_ds );
void set_errno_error( const char * const msg );
void set_num_error( const char * const msg, unsigned long long num );
- bool read_header( const int fd, Lzip_header & header, const long long pos );
+ bool read_header( const int fd, Lzip_header & header, const long long pos,
+ const bool ignore_marking = true );
bool read_trailer( const int fd, Lzip_trailer & trailer,
const long long pos );
bool skip_gap( const int fd, unsigned long long & pos,
- const bool ignore_trailing, const bool loose_trailing,
+ const Cl_options & cl_opts,
const bool ignore_bad_ds, const bool ignore_gaps );
public:
Lzip_index()
- : error_( "No index" ), insize( 0 ), retval_( 2 ), dictionary_size_( 0 ) {}
- Lzip_index( const int infd, const bool ignore_trailing,
- const bool loose_trailing, const bool ignore_bad_ds = false,
- const bool ignore_gaps = false, const long long max_pos = 0 );
+ : error_( "No index" ), insize( 0 ), retval_( 2 ),
+ dictionary_size_( 0 ), bad_magic_( false ) {}
+ Lzip_index( const int infd, const Cl_options & cl_opts,
+ const bool ignore_bad_ds = false, const bool ignore_gaps = false,
+ const long long max_pos = 0 );
Lzip_index( const std::vector< int > & infd_vector, const long long fsize );
long members() const { return member_vector.size(); }
@@ -62,6 +67,7 @@ public:
const std::string & error() const { return error_; }
int retval() const { return retval_; }
unsigned dictionary_size() const { return dictionary_size_; }
+ bool bad_magic() const { return bad_magic_; }
bool operator==( const Lzip_index & li ) const
{