| 102 | } |
| 103 | |
| 104 | void ByteInputStream::seekp(std::streampos position) { |
| 105 | if (ranges_.empty() && position == 0) { |
| 106 | return; |
| 107 | } |
| 108 | int64_t toSkip = position; |
| 109 | for (auto& range : ranges_) { |
| 110 | if (toSkip <= range.size) { |
| 111 | current_ = ⦥ |
| 112 | current_->position = toSkip; |
| 113 | return; |
| 114 | } |
| 115 | toSkip -= range.size; |
| 116 | } |
| 117 | static_assert(sizeof(std::streamsize) <= sizeof(long long)); |
| 118 | BOLT_FAIL( |
| 119 | "Seeking past end of ByteInputStream: {}", |
| 120 | static_cast<long long>(position)); |
| 121 | } |
| 122 | |
| 123 | void ByteInputStream::next(bool throwIfPastEnd) { |
| 124 | BOLT_CHECK(current_ >= &ranges_[0]); |
no test coverage detected