diff options
Diffstat (limited to 'lzip_index.cc')
-rw-r--r-- | lzip_index.cc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lzip_index.cc b/lzip_index.cc index 332fe63..02e3d28 100644 --- a/lzip_index.cc +++ b/lzip_index.cc @@ -148,13 +148,12 @@ bool Lzip_index::skip_gap( const int fd, unsigned long long & pos, if( !cl_opts.ignore_trailing ) { error_ = trailing_msg; retval_ = 2; return false; } } - const unsigned long long data_size = trailer.data_size(); pos = ipos + i - member_size; // good member const unsigned dictionary_size = header.dictionary_size(); if( dictionary_size_ < dictionary_size ) dictionary_size_ = dictionary_size; - member_vector.push_back( Member( 0, data_size, pos, member_size, - dictionary_size ) ); + member_vector.push_back( Member( 0, trailer.data_size(), pos, + member_size, dictionary_size ) ); return true; } if( ipos == 0 ) @@ -197,7 +196,7 @@ Lzip_index::Lzip_index( const int infd, const Cl_options & cl_opts, retval_ = 2; return; } // pos always points to a header or to ( EOF || max_pos ) - unsigned long long pos = ( max_pos > 0 ) ? max_pos : insize; + unsigned long long pos = (max_pos > 0) ? max_pos : insize; while( pos >= min_member_size ) { Lzip_trailer trailer; @@ -221,13 +220,12 @@ Lzip_index::Lzip_index( const int infd, const Cl_options & cl_opts, continue; else return; } set_num_error( "Bad header at pos ", pos - member_size ); break; } - const unsigned long long data_size = trailer.data_size(); pos -= member_size; // good member const unsigned dictionary_size = header.dictionary_size(); if( dictionary_size_ < dictionary_size ) dictionary_size_ = dictionary_size; - member_vector.push_back( Member( 0, data_size, pos, member_size, - dictionary_size ) ); + member_vector.push_back( Member( 0, trailer.data_size(), pos, + member_size, dictionary_size ) ); } // block at pos == 0 must be a member unless shorter than min_member_size if( pos >= min_member_size || ( pos != 0 && !ignore_gaps ) || @@ -237,10 +235,6 @@ Lzip_index::Lzip_index( const int infd, const Cl_options & cl_opts, if( retval_ == 0 ) { error_ = "Can't create file index."; retval_ = 2; } return; } - if( !cl_opts.ignore_empty && member_vector.size() > 1 ) - for( unsigned long i = 0; i < member_vector.size(); ++i ) - if( member_vector[i].dblock.size() == 0 ) - { member_vector.clear(); error_ = empty_msg; retval_ = 2; return; } std::reverse( member_vector.begin(), member_vector.end() ); for( unsigned long i = 0; ; ++i ) { |