diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2017-01-30 00:04:08 +0100 |
---|---|---|
committer | Samuel Gaist <samuel.gaist@edeltech.ch> | 2017-12-30 23:34:00 +0000 |
commit | 2b0eb3fac319a17dd92903106d501f0f06df871f (patch) | |
tree | 3940fbe64c9a56c6a00adc779101708b66b7a07e /src | |
parent | 83aca24bc4941d1be48719250e64a30a785d1c07 (diff) |
Remove use of QRegExp from QSharedMemory
This patch updates the code from QSharedMemory to remove the use
of the deprecated QRegExp class. It also updates the unique key
test to avoid change of behavior going undetected.
Change-Id: I649e615027507898800bb5454a62a6cf8bbb2e18
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qsharedmemory.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index c8ba13c90c..c952655cb8 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -67,9 +67,11 @@ QSharedMemoryPrivate::makePlatformSafeKey(const QString &key, QString result = prefix; - QString part1 = key; - part1.replace(QRegExp(QLatin1String("[^A-Za-z]")), QString()); - result.append(part1); + for (QChar ch : key) { + if ((ch >= QLatin1Char('a') && ch <= QLatin1Char('z')) || + (ch >= QLatin1Char('A') && ch <= QLatin1Char('Z'))) + result += ch; + } QByteArray hex = QCryptographicHash::hash(key.toUtf8(), QCryptographicHash::Sha1).toHex(); result.append(QLatin1String(hex)); |