MCPcopy Create free account
hub / github.com/bytedance/bolt / seekp

Method seekp

bolt/common/memory/ByteStream.cpp:104–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void 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_ = &range;
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
123void ByteInputStream::next(bool throwIfPastEnd) {
124 BOLT_CHECK(current_ >= &ranges_[0]);

Callers 7

toStringMethod · 0.45
prepareReadFunction · 0.45
appendMethod · 0.45
namesAndTypesToStringFunction · 0.45
TEST_FFunction · 0.45
TEST_PFunction · 0.45
TEST_FFunction · 0.45

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected