diff options
Diffstat (limited to 'src/handle.cpp')
-rw-r--r-- | src/handle.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/handle.cpp b/src/handle.cpp index a6ab3a5..1147cf6 100644 --- a/src/handle.cpp +++ b/src/handle.cpp @@ -3,6 +3,7 @@ // For details, see https://github.com/egor-tensin/winapi-common. // Distributed under the MIT License. +#include <winapi/buffer.hpp> #include <winapi/error.hpp> #include <winapi/handle.hpp> #include <winapi/workarounds.hpp> @@ -15,6 +16,7 @@ #include <cstddef> #include <sstream> #include <stdexcept> +#include <utility> namespace winapi { namespace { @@ -100,15 +102,13 @@ bool Handle::read_chunk(Buffer& buffer) const { } } -Handle::Buffer Handle::read() const { +Buffer Handle::read() const { Buffer buffer; - Buffer chunk; while (true) { + Buffer chunk; const auto next = read_chunk(chunk); - - buffer.reserve(buffer.size() + chunk.size()); - buffer.insert(buffer.cend(), chunk.cbegin(), chunk.cend()); + buffer.add(chunk); if (!next) { break; |