aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-12-12 19:11:16 +0300
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-12-12 19:11:16 +0300
commit1ffa6b96adeba8c1a00a0a32112c8b0aaeb2350e (patch)
treef479f2fff08ee16939a08e5aaaafb0f28015a522 /lib/jobs
parentc15771776cf277e6235fce6ebb6c6d7e3702a257 (diff)
downloadlibquotient-1ffa6b96adeba8c1a00a0a32112c8b0aaeb2350e.tar.gz
libquotient-1ffa6b96adeba8c1a00a0a32112c8b0aaeb2350e.zip
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.
Diffstat (limited to 'lib/jobs')
-rw-r--r--lib/jobs/requestdata.cpp5
1 files changed, 2 insertions, 3 deletions
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<QBuffer>();
- source->open(QIODevice::WriteOnly);
- source->write(data);
- source->close();
+ source->setData(data);
+ source->open(QIODevice::ReadOnly);
return source;
}