summaryrefslogtreecommitdiffstats
path: root/file_index.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:45:50 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:45:50 +0000
commit0763626b1d5a396a8d78985c9a445763686f92f8 (patch)
tree128aaf42cc9d59adf31b97b65788a0b56acb8da3 /file_index.cc
parentAdding debian version 1.16~pre1-1. (diff)
downloadlziprecover-0763626b1d5a396a8d78985c9a445763686f92f8.tar.xz
lziprecover-0763626b1d5a396a8d78985c9a445763686f92f8.zip
Merging upstream version 1.16~pre2.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'file_index.cc')
-rw-r--r--file_index.cc13
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 )