diff options
author | Julian Andres Klode <jak@debian.org> | 2016-02-01 16:28:43 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-02-01 16:29:13 +0100 |
commit | 070ed1c9147c092c1f944afd1c17c51f651a5c39 (patch) | |
tree | 1217a5cada66e3e3e41894a6e15068a629d20e45 | |
parent | 47fcfff8a50caebe3cd1f2ee19875a2ca8bbeadc (diff) |
BufferedWriteFileFdPrivate: Simplify InternalWrite()
We do not need the loop, FileFd::Private() handles this for us.
Gbp-Dch: ignore
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 12 |
1 files changed, 3 insertions, 9 deletions
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<char const*>(From) + written, Size - written); - - written += buffered; - - if (writebuffer.full() && InternalFlush() == false) - return -1; - } + if (writebuffer.full() && InternalFlush() == false) + return -1; return written; } |