14 const int64_t start = offset;
15 const int64_t end = offset + int64_t(size);
17 int64_t global_end = 0;
19 for (
auto b: db.get_buffer_table())
21 const int64_t b_start = db.get_offset(b);
22 const int64_t b_end = b_start + db.get_size(b);
24 const int64_t intersection_start = std::max(start, b_start);
25 const int64_t intersection_end = std::min(end, b_end);
26 const int64_t intersection_size = intersection_end - intersection_start;
28 if (intersection_size > 0)
30 if (intersection_end > global_end)
31 global_end = intersection_end;
33 if (b != decoded_buffer)
35 if (int64_t(read_buffer.size()) < db.get_size(b))
36 read_buffer.resize(
size_t(db.get_size(b)));
40 blob_reader.read_blob_data(db.get_data(b)),
42 size_t(db.get_size(b))
50 read_buffer.data() + intersection_start - b_start,
52 buffer + intersection_start - start
57 return size_t(global_end - offset);