From: Julian Andres Klode Date: Mon, 1 Feb 2016 15:28:43 +0000 (+0100) Subject: BufferedWriteFileFdPrivate: Simplify InternalWrite() X-Git-Tag: 1.2.2~14 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/070ed1c9147c092c1f944afd1c17c51f651a5c39?ds=inline BufferedWriteFileFdPrivate: Simplify InternalWrite() We do not need the loop, FileFd::Private() handles this for us. Gbp-Dch: ignore --- 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; }