QtNetwork: use reserve to optimize memory allocation
Change-Id: Ia328bae007831f4b78a5688aaf03ae59c12b7425 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
f720619e0d
commit
bc2565146a
@ -70,6 +70,7 @@ QList<QByteArray> QSslSocketPrivate::fetchSslCertificateData()
|
||||
QJNIEnvironmentPrivate env;
|
||||
jobjectArray jcertificates = static_cast<jobjectArray>(certificates.object());
|
||||
const jint nCertificates = env->GetArrayLength(jcertificates);
|
||||
certificateData.reserve(static_cast<int>(nCertificates));
|
||||
|
||||
for (int i = 0; i < nCertificates; ++i) {
|
||||
jbyteArray jCert = static_cast<jbyteArray>(env->GetObjectArrayElement(jcertificates, i));
|
||||
|
@ -215,7 +215,9 @@ QList<QSslCipher> QSslSocketBackendPrivate::defaultCiphers()
|
||||
const QString protocolStrings[] = { QStringLiteral("SSLv3"), QStringLiteral("TLSv1"),
|
||||
QStringLiteral("TLSv1.1"), QStringLiteral("TLSv1.2") };
|
||||
const QSsl::SslProtocol protocols[] = { QSsl::SslV3, QSsl::TlsV1_0, QSsl::TlsV1_1, QSsl::TlsV1_2 };
|
||||
for (int i = 0; i < ARRAYSIZE(protocols); ++i) {
|
||||
const int size = static_cast<int>(ARRAYSIZE(protocols));
|
||||
ciphers.reserve(size);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
QSslCipher cipher;
|
||||
cipher.d->isNull = false;
|
||||
cipher.d->name = QStringLiteral("WINRT");
|
||||
|
Loading…
Reference in New Issue
Block a user