diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-12-12 19:11:16 +0300 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-12-12 19:11:16 +0300 |
commit | 1ffa6b96adeba8c1a00a0a32112c8b0aaeb2350e (patch) | |
tree | f479f2fff08ee16939a08e5aaaafb0f28015a522 /lib/jobs | |
parent | c15771776cf277e6235fce6ebb6c6d7e3702a257 (diff) | |
download | libquotient-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.cpp | 5 |
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; } |