Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
// ### FIXME!!
// Obtain a pointer from the ringbuffer!
// Avoid extra copy
- QByteArray data;
- data.reserve(wantToRead);
+ QByteArray data(wantToRead, Qt::Uninitialized);
qint64 actuallyRead = file.read(data.data(), wantToRead);
if (actuallyRead <= 0) {
// EOF or error
if (mode == QSslSocket::UnencryptedMode && !autoStartHandshake) {
//unencrypted mode - do not use QIODevice::peek, as it reads ahead data from the plain socket
//peek at data already in the QIODevice buffer (from a previous read)
- QByteArray ret;
- ret.reserve(maxSize);
+ QByteArray ret(maxSize, Qt::Uninitialized);
ret.resize(buffer.peek(ret.data(), maxSize));
if (ret.length() == maxSize)
return ret;