If the desired offset overlaps a BH, data.lower_bound() will return
the element after it, since it's indexed by the start of a range.
The confusingly similarly named data_lower_bound() method fixes this,
and returns the correct starting element.
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
// apply to bh's!
loff_t opos = start;
while (true) {
- map<loff_t, BufferHead*>::iterator p = ob->data.lower_bound(opos);
+ map<loff_t, BufferHead*>::iterator p = ob->data_lower_bound(opos);
if (p == ob->data.end())
break;
if (opos >= start+(loff_t)length) {
}
// apply to bh's!
- for (map<loff_t, BufferHead*>::iterator p = ob->data.lower_bound(start);
+ for (map<loff_t, BufferHead*>::iterator p = ob->data_lower_bound(start);
p != ob->data.end();
p++) {
BufferHead *bh = p->second;