| 44 | } |
| 45 | |
| 46 | const StoredObject * OffsetMap::findObjectAt(size_t logical_offset, size_t * object_logical_start_offset) const |
| 47 | { |
| 48 | /// Linear scan: the segment count equals the file's object count, a handful at most. |
| 49 | for (const auto & seg : segments) |
| 50 | { |
| 51 | if (seg.logical_offset <= logical_offset && logical_offset < seg.logical_offset + seg.size) |
| 52 | { |
| 53 | if (object_logical_start_offset) |
| 54 | *object_logical_start_offset = seg.logical_offset; |
| 55 | return &seg.object; |
| 56 | } |
| 57 | } |
| 58 | return nullptr; |
| 59 | } |
| 60 | |
| 61 | } |
no outgoing calls