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.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/extractor_datasource.c b/src/main/extractor_datasource.c
index c01e62a..e6eaee6 100644
--- a/src/main/extractor_datasource.c
+++ b/src/main/extractor_datasource.c
@@ -117,19 +117,20 @@ struct BufferedFileDataSource
117 uint64_t fpos; 117 uint64_t fpos;
118 118
119 /** 119 /**
120 * Position within the buffer. 120 * Position within the buffer. Our absolute offset in the file
121 * is thus 'fpos + buffer_pos'.
121 */ 122 */
122 uint64_t buffer_pos; 123 size_t buffer_pos;
123 124
124 /** 125 /**
125 * Number of valid bytes in the buffer (<= buffer_size) 126 * Number of valid bytes in the buffer (<= buffer_size)
126 */ 127 */
127 uint64_t buffer_bytes; 128 size_t buffer_bytes;
128 129
129 /** 130 /**
130 * Allocated size of the buffer 131 * Allocated size of the buffer
131 */ 132 */
132 uint64_t buffer_size; 133 size_t buffer_size;
133 134
134 /** 135 /**
135 * Descriptor of the file to read data from (may be -1) 136 * Descriptor of the file to read data from (may be -1)
@@ -377,8 +378,8 @@ bfds_seek (struct BufferedFileDataSource *bfds,
377 return -1; 378 return -1;
378 } 379 }
379 if ( (NULL == bfds->buffer) || 380 if ( (NULL == bfds->buffer) ||
380 ( (bfds->buffer_pos + bfds->fpos <= pos) && 381 ( (bfds->fpos <= pos) &&
381 (bfds->buffer_pos + bfds->fpos + bfds->buffer_bytes > pos) ) ) 382 (bfds->fpos + bfds->buffer_bytes > pos) ) )
382 { 383 {
383 bfds->buffer_pos = pos - bfds->fpos; 384 bfds->buffer_pos = pos - bfds->fpos;
384 return pos; 385 return pos;