diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 11:45:45 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 11:45:45 +0000 |
commit | 5e8398a39d8758cb4dee9a43f92ac958277e0ebd (patch) | |
tree | 10ba2517467532e4a002f47cc32732f1f335eae0 /file_index.cc | |
parent | Adding upstream version 1.16~pre1. (diff) | |
download | lziprecover-5e8398a39d8758cb4dee9a43f92ac958277e0ebd.tar.xz lziprecover-5e8398a39d8758cb4dee9a43f92ac958277e0ebd.zip |
Adding upstream version 1.16~pre2.upstream/1.16_pre2
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r-- | file_index.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/file_index.cc b/file_index.cc index cdb4031..b4f5420 100644 --- a/file_index.cc +++ b/file_index.cc @@ -28,6 +28,15 @@ #include "file_index.h" +int seek_read( const int fd, uint8_t * const buf, const int size, + const long long pos ) + { + if( lseek( fd, pos, SEEK_SET ) == pos ) + return readblock( fd, buf, size ); + return 0; + } + + Block Block::split( const long long pos ) { if( pos > pos_ && pos < end() ) @@ -120,7 +129,7 @@ File_index::File_index( const int infd ) return; } std::reverse( member_vector.begin(), member_vector.end() ); - for( unsigned i = 0; i < member_vector.size() - 1; ++i ) + for( unsigned long i = 0; i < member_vector.size() - 1; ++i ) { const long long end = member_vector[i].dblock.end(); if( end < 0 || end > INT64_MAX ) @@ -214,7 +223,7 @@ error: return; } std::reverse( member_vector.begin(), member_vector.end() ); - for( unsigned i = 0; i < member_vector.size() - 1; ++i ) + for( unsigned long i = 0; i < member_vector.size() - 1; ++i ) { const long long end = member_vector[i].dblock.end(); if( end < 0 || end > INT64_MAX ) |