summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-02-01 16:28:43 +0100
committerJulian Andres Klode <jak@debian.org>2016-02-01 16:29:13 +0100
commit070ed1c9147c092c1f944afd1c17c51f651a5c39 (patch)
tree1217a5cada66e3e3e41894a6e15068a629d20e45 /apt-pkg/contrib/fileutl.cc
parent47fcfff8a50caebe3cd1f2ee19875a2ca8bbeadc (diff)
BufferedWriteFileFdPrivate: Simplify InternalWrite()
We do not need the loop, FileFd::Private() handles this for us. Gbp-Dch: ignore
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc12
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;
}