summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslsocket_mac.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-03-31 13:05:11 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-04-04 04:58:00 +0000
commitf68c62cdfc4d66def52aa73fbc2ad58acc32af62 (patch)
tree20ab07c1ffd5dcf661ab0a3b4e28b3cba7f85ba3 /src/network/ssl/qsslsocket_mac.cpp
parent36bc2477753d19a14c587b97d4ec4f263e9e16c0 (diff)
QSslSocket (Mac): optimize string usage
Wrap C-string in QL1S to prevent memory allocation. Replace startsWith() with comparing to first element of (existing) splitting result. Change-Id: Id47a0c350e4027abecd1394c1ee5dec8f346af00 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Diffstat (limited to 'src/network/ssl/qsslsocket_mac.cpp')
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index da9c8c165b..99ae7923f4 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -871,9 +871,9 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
if (bits.size() >= 2) {
if (bits.size() == 2 || bits.size() == 3) {
ciph.d->keyExchangeMethod = QLatin1String("RSA");
- } else if (ciph.d->name.startsWith("DH-") || ciph.d->name.startsWith("DHE-")) {
+ } else if (bits.front() == QLatin1String("DH") || bits.front() == QLatin1String("DHE")) {
ciph.d->keyExchangeMethod = QLatin1String("DH");
- } else if (ciph.d->name.startsWith("ECDH-") || ciph.d->name.startsWith("ECDHE-")) {
+ } else if (bits.front() == QLatin1String("ECDH") || bits.front() == QLatin1String("ECDHE")) {
ciph.d->keyExchangeMethod = QLatin1String("ECDH");
} else {
qCWarning(lcSsl) << "Unknown Kx" << ciph.d->name;
@@ -881,35 +881,35 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui
if (bits.size() == 2 || bits.size() == 3) {
ciph.d->authenticationMethod = QLatin1String("RSA");
- } else if (ciph.d->name.contains("-ECDSA-")) {
+ } else if (ciph.d->name.contains(QLatin1String("-ECDSA-"))) {
ciph.d->authenticationMethod = QLatin1String("ECDSA");
- } else if (ciph.d->name.contains("-RSA-")) {
+ } else if (ciph.d->name.contains(QLatin1String("-RSA-"))) {
ciph.d->authenticationMethod = QLatin1String("RSA");
} else {
qCWarning(lcSsl) << "Unknown Au" << ciph.d->name;
}
- if (ciph.d->name.contains("RC4-")) {
+ if (ciph.d->name.contains(QLatin1String("RC4-"))) {
ciph.d->encryptionMethod = QLatin1String("RC4(128)");
ciph.d->bits = 128;
ciph.d->supportedBits = 128;
- } else if (ciph.d->name.contains("DES-CBC3-")) {
+ } else if (ciph.d->name.contains(QLatin1String("DES-CBC3-"))) {
ciph.d->encryptionMethod = QLatin1String("3DES(168)");
ciph.d->bits = 168;
ciph.d->supportedBits = 168;
- } else if (ciph.d->name.contains("AES128-")) {
+ } else if (ciph.d->name.contains(QLatin1String("AES128-"))) {
ciph.d->encryptionMethod = QLatin1String("AES(128)");
ciph.d->bits = 128;
ciph.d->supportedBits = 128;
- } else if (ciph.d->name.contains("AES256-GCM")) {
+ } else if (ciph.d->name.contains(QLatin1String("AES256-GCM"))) {
ciph.d->encryptionMethod = QLatin1String("AESGCM(256)");
ciph.d->bits = 256;
ciph.d->supportedBits = 256;
- } else if (ciph.d->name.contains("AES256-")) {
+ } else if (ciph.d->name.contains(QLatin1String("AES256-"))) {
ciph.d->encryptionMethod = QLatin1String("AES(256)");
ciph.d->bits = 256;
ciph.d->supportedBits = 256;
- } else if (ciph.d->name.contains("NULL-")) {
+ } else if (ciph.d->name.contains(QLatin1String("NULL-"))) {
ciph.d->encryptionMethod = QLatin1String("NULL");
} else {
qCWarning(lcSsl) << "Unknown Enc" << ciph.d->name;