QSslSocket/macOS: optimize QUuid usage
- don't create a QString, a QByteArray suffices - perform the mid() operation on a view type (QLatin1String), not on a container - use QStringBuilder Change-Id: Ifd74f2bc98606425f9f6cb4da8618e8066a8b12e Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
This commit is contained in:
parent
30efb14313
commit
e91726ef9e
@ -96,16 +96,14 @@ EphemeralSecKeychain::EphemeralSecKeychain()
|
||||
return;
|
||||
}
|
||||
|
||||
QString uuidAsString(uuid.toString());
|
||||
Q_ASSERT(uuidAsString.size() > 2);
|
||||
Q_ASSERT(uuidAsString.startsWith(QLatin1Char('{'))
|
||||
&& uuidAsString.endsWith(QLatin1Char('}')));
|
||||
uuidAsString = uuidAsString.mid(1, uuidAsString.size() - 2);
|
||||
const QByteArray uuidAsByteArray = uuid.toByteArray();
|
||||
Q_ASSERT(uuidAsByteArray.size() > 2);
|
||||
Q_ASSERT(uuidAsByteArray.startsWith('{'));
|
||||
Q_ASSERT(uuidAsByteArray.endsWith('}'));
|
||||
const auto uuidAsString = QLatin1String(uuidAsByteArray.data(), uuidAsByteArray.size()).mid(1, uuidAsByteArray.size() - 2);
|
||||
|
||||
QString keychainName(QDir::tempPath());
|
||||
keychainName.append(QDir::separator());
|
||||
keychainName += uuidAsString;
|
||||
keychainName += QLatin1String(".keychain");
|
||||
const QString keychainName
|
||||
= QDir::tempPath() + QDir::separator() + uuidAsString + QLatin1String(".keychain");
|
||||
// SecKeychainCreate, pathName parameter:
|
||||
//
|
||||
// "A constant character string representing the POSIX path indicating where
|
||||
|
Loading…
Reference in New Issue
Block a user