aboutsummaryrefslogtreecommitdiff
path: root/src/main/extractor_datasource.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/extractor_datasource.c')
-rw-r--r--src/main/extractor_datasource.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/extractor_datasource.c b/src/main/extractor_datasource.c
index f15321f..d25cc5b 100644
--- a/src/main/extractor_datasource.c
+++ b/src/main/extractor_datasource.c
@@ -321,6 +321,7 @@ bfds_seek (struct BufferedFileDataSource *bfds,
321 int64_t pos, int whence) 321 int64_t pos, int whence)
322{ 322{
323 uint64_t npos; 323 uint64_t npos;
324 size_t nbpos;
324 325
325 switch (whence) 326 switch (whence)
326 { 327 {
@@ -334,11 +335,11 @@ bfds_seek (struct BufferedFileDataSource *bfds,
334 (unsigned long long) bfds->fsize); 335 (unsigned long long) bfds->fsize);
335 return -1; 336 return -1;
336 } 337 }
338 nbpos = bfds->buffer_pos + pos;
337 if ( (NULL == bfds->buffer) || 339 if ( (NULL == bfds->buffer) ||
338 ( (bfds->buffer_pos + pos < bfds->buffer_bytes) && 340 (nbpos < bfds->buffer_bytes) )
339 (bfds->buffer_pos + pos >= 0) ) )
340 { 341 {
341 bfds->buffer_pos += pos; 342 bfds->buffer_pos = nbpos;
342 return npos; 343 return npos;
343 } 344 }
344 if (0 != bfds_pick_next_buffer_at (bfds, 345 if (0 != bfds_pick_next_buffer_at (bfds,