summaryrefslogtreecommitdiffstats
path: root/file_index.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 )