Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/butil/iobuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1849,10 +1849,9 @@ void IOBufAsZeroCopyInputStream::BackUp(int count) {
}
}

// Skips a number of bytes. Returns false if the end of the stream is
// reached or some input error occurred. In the end-of-stream case, the
// stream is advanced to the end of the stream (so ByteCount() will return
// the total size of the stream).
// Skips a number of bytes. Return false if some input error occurred.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the comment with protocolbuffers/protobuf@ab25c3e .

// In the end-of-stream case, the stream is advanced to the end of the
// stream (so ByteCount() will return the total size of the stream).
bool IOBufAsZeroCopyInputStream::Skip(int count) {
const IOBuf::BlockRef* cur_ref = _buf->_pref_at(_ref_index);
while (cur_ref) {
Expand All @@ -1867,7 +1866,7 @@ bool IOBufAsZeroCopyInputStream::Skip(int count) {
_byte_count += left_bytes;
cur_ref = _buf->_pref_at(++_ref_index);
}
return false;
return (0 == count);
}

int64_t IOBufAsZeroCopyInputStream::ByteCount() const {
Expand Down Expand Up @@ -2102,4 +2101,4 @@ bool IOBufBytesIterator::forward_one_block(const void** data, size_t* size) {

void* fast_memcpy(void *__restrict dest, const void *__restrict src, size_t n) {
return butil::iobuf::cp(dest, src, n);
} // namespace butil
} // namespace butil
Loading