From 1ffa6b96adeba8c1a00a0a32112c8b0aaeb2350e Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 12 Dec 2019 19:11:16 +0300 Subject: RequestData: optimise fromData() and preopen the buffer It was just a coincidence that QBuffer allowed reading from it without being isReadable() at the moment of starting a job. --- lib/jobs/requestdata.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/jobs/requestdata.cpp') diff --git a/lib/jobs/requestdata.cpp b/lib/jobs/requestdata.cpp index 0c70f085..cec15954 100644 --- a/lib/jobs/requestdata.cpp +++ b/lib/jobs/requestdata.cpp @@ -11,9 +11,8 @@ using namespace Quotient; auto fromData(const QByteArray& data) { auto source = std::make_unique(); - source->open(QIODevice::WriteOnly); - source->write(data); - source->close(); + source->setData(data); + source->open(QIODevice::ReadOnly); return source; } -- cgit v1.2.3