The input length should be equal to bufferlist length, so the round_length
is always equal to bp.length().
Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
const auto* other_buf = reinterpret_cast<const char*>(other);
for (const auto& bp : buffers()) {
- const auto round_length = std::min<size_t>(length, bp.length());
- if (std::memcmp(bp.c_str(), other_buf, round_length) != 0) {
+ assert(bp.length() <= length);
+ if (std::memcmp(bp.c_str(), other_buf, bp.length()) != 0) {
return false;
} else {
- length -= round_length;
- other_buf += round_length;
+ length -= bp.length();
+ other_buf += bp.length();
}
}