From 070ed1c9147c092c1f944afd1c17c51f651a5c39 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 1 Feb 2016 16:28:43 +0100 Subject: BufferedWriteFileFdPrivate: Simplify InternalWrite() We do not need the loop, FileFd::Private() handles this for us. Gbp-Dch: ignore --- apt-pkg/contrib/fileutl.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'apt-pkg/contrib/fileutl.cc') diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 004df3fe8..d95748aa6 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1260,16 +1260,10 @@ public: } virtual ssize_t InternalWrite(void const * const From, unsigned long long const Size) override { - size_t written = 0; + auto written = writebuffer.write(From, Size); - while (written < Size) { - auto buffered = writebuffer.write(static_cast(From) + written, Size - written); - - written += buffered; - - if (writebuffer.full() && InternalFlush() == false) - return -1; - } + if (writebuffer.full() && InternalFlush() == false) + return -1; return written; } -- cgit v1.2.3