From 4b0a204b9cec120ba42a4af518314ad25fdfddd8 Mon Sep 17 00:00:00 2001 From: zhaohanqing Date: Wed, 11 Mar 2026 15:23:53 +0800 Subject: [PATCH] return true if the end of the stream is reached --- src/butil/iobuf.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/butil/iobuf.cpp b/src/butil/iobuf.cpp index 26046e3745..034cfccde0 100644 --- a/src/butil/iobuf.cpp +++ b/src/butil/iobuf.cpp @@ -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. +// 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) { @@ -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 { @@ -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 \ No newline at end of file +} // namespace butil