Commit a877926f authored by Max Kellermann's avatar Max Kellermann

Revert "AsyncInputStream: fix assertion failure in AppendToBuffer()"

This reverts commit 966c4244. The commit was bad, because the bug was really in NfsInputStream::DoRead(); see previous commit.
parent 3e4e6f7c
...@@ -222,13 +222,11 @@ AsyncInputStream::AppendToBuffer(const void *data, size_t append_size) ...@@ -222,13 +222,11 @@ AsyncInputStream::AppendToBuffer(const void *data, size_t append_size)
const size_t remaining = append_size - nbytes; const size_t remaining = append_size - nbytes;
if (remaining > 0) { if (remaining > 0) {
w = buffer.Write(); w = buffer.Write();
assert(!w.IsEmpty());
assert(w.size >= remaining);
if (!w.IsEmpty()) { memcpy(w.data, (const uint8_t *)data + nbytes, remaining);
size_t nbytes2 = std::min(w.size, remaining); buffer.Append(remaining);
memcpy(w.data, (const uint8_t *)data + nbytes,
nbytes2);
buffer.Append(nbytes2);
}
} }
if (!IsReady()) if (!IsReady())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment