| 186 | } |
| 187 | |
| 188 | void HashStringAllocator::extendWrite( |
| 189 | Position position, |
| 190 | ByteOutputStream& stream) { |
| 191 | auto header = position.header; |
| 192 | const auto offset = position.offset(); |
| 193 | BOLT_CHECK_GE(offset, 0, "Starting extendWrite outside of the current range"); |
| 194 | BOLT_CHECK_LE( |
| 195 | offset, |
| 196 | header->usableSize(), |
| 197 | "Starting extendWrite outside of the current range"); |
| 198 | |
| 199 | if (header->isContinued()) { |
| 200 | free(header->nextContinued()); |
| 201 | header->clearContinued(); |
| 202 | } |
| 203 | |
| 204 | stream.setRange( |
| 205 | ByteRange{ |
| 206 | reinterpret_cast<uint8_t*>(position.header->begin()), |
| 207 | position.header->size(), |
| 208 | static_cast<int32_t>(position.position - position.header->begin())}, |
| 209 | 0); |
| 210 | currentHeader_ = header; |
| 211 | startPosition_ = position; |
| 212 | } |
| 213 | |
| 214 | std::pair<HashStringAllocator::Position, HashStringAllocator::Position> |
| 215 | HashStringAllocator::finishWrite( |