aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/AsyncInputStream.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-06-21 14:07:15 +0200
committerMax Kellermann <max@duempel.org>2014-06-21 14:07:15 +0200
commita877926f087aa86ef90bb8b194f6f8e620fff568 (patch)
treee8dc39ce0c5e8a4540c728df7219f96c4522f7ef /src/input/AsyncInputStream.cxx
parent3e4e6f7ced979570588c7e341250ebaea2e3bffb (diff)
downloadmpd-a877926f087aa86ef90bb8b194f6f8e620fff568.tar.gz
mpd-a877926f087aa86ef90bb8b194f6f8e620fff568.tar.xz
mpd-a877926f087aa86ef90bb8b194f6f8e620fff568.zip
Revert "AsyncInputStream: fix assertion failure in AppendToBuffer()"
This reverts commit 966c4244cbe0de174df1e72e917078269ec9dbb9. The commit was bad, because the bug was really in NfsInputStream::DoRead(); see previous commit.
Diffstat (limited to '')
-rw-r--r--src/input/AsyncInputStream.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/input/AsyncInputStream.cxx b/src/input/AsyncInputStream.cxx
index 9b827463d..43190f907 100644
--- a/src/input/AsyncInputStream.cxx
+++ b/src/input/AsyncInputStream.cxx
@@ -222,13 +222,11 @@ AsyncInputStream::AppendToBuffer(const void *data, size_t append_size)
const size_t remaining = append_size - nbytes;
if (remaining > 0) {
w = buffer.Write();
+ assert(!w.IsEmpty());
+ assert(w.size >= remaining);
- if (!w.IsEmpty()) {
- size_t nbytes2 = std::min(w.size, remaining);
- memcpy(w.data, (const uint8_t *)data + nbytes,
- nbytes2);
- buffer.Append(nbytes2);
- }
+ memcpy(w.data, (const uint8_t *)data + nbytes, remaining);
+ buffer.Append(remaining);
}
if (!IsReady())