summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qsharedmemory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qsharedmemory.cpp')
-rw-r--r--src/corelib/kernel/qsharedmemory.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp
index 3dbbe75fc4..ba8bf5eca3 100644
--- a/src/corelib/kernel/qsharedmemory.cpp
+++ b/src/corelib/kernel/qsharedmemory.cpp
@@ -60,6 +60,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
#if !(defined(QT_NO_SHAREDMEMORY) && defined(QT_NO_SYSTEMSEMAPHORE))
/*!
\internal
@@ -90,14 +92,14 @@ QSharedMemoryPrivate::makePlatformSafeKey(const QString &key,
// so we can't use the logic below of combining the prefix, key, and a hash,
// to ensure a unique and valid name. Instead we use the first part of the
// hash, which should still long enough to avoid collisions in practice.
- return QLatin1Char('/') + hex.left(SHM_NAME_MAX - 1);
+ return u'/' + hex.left(SHM_NAME_MAX - 1);
}
#endif
QString result = prefix;
for (QChar ch : key) {
- if ((ch >= QLatin1Char('a') && ch <= QLatin1Char('z')) ||
- (ch >= QLatin1Char('A') && ch <= QLatin1Char('Z')))
+ if ((ch >= u'a' && ch <= u'z') ||
+ (ch >= u'A' && ch <= u'Z'))
result += ch;
}
result.append(QLatin1String(hex));
@@ -105,9 +107,9 @@ QSharedMemoryPrivate::makePlatformSafeKey(const QString &key,
#ifdef Q_OS_WIN
return result;
#elif defined(QT_POSIX_IPC)
- return QLatin1Char('/') + result;
+ return u'/' + result;
#else
- return QDir::tempPath() + QLatin1Char('/') + result;
+ return QDir::tempPath() + u'/' + result;
#endif
}
#endif // QT_NO_SHAREDMEMORY && QT_NO_SHAREDMEMORY
@@ -321,7 +323,7 @@ bool QSharedMemoryPrivate::initKey()
systemSemaphore.setKey(QString(), 1);
systemSemaphore.setKey(key, 1);
if (systemSemaphore.error() != QSystemSemaphore::NoError) {
- QString function = QLatin1String("QSharedMemoryPrivate::initKey");
+ QString function = "QSharedMemoryPrivate::initKey"_L1;
errorString = QSharedMemory::tr("%1: unable to set key on lock").arg(function);
switch(systemSemaphore.error()) {
case QSystemSemaphore::PermissionDenied:
@@ -412,7 +414,7 @@ bool QSharedMemory::create(qsizetype size, AccessMode mode)
#endif
#endif
- QString function = QLatin1String("QSharedMemory::create");
+ QString function = "QSharedMemory::create"_L1;
#ifndef QT_NO_SYSTEMSEMAPHORE
QSharedMemoryLocker lock(this);
if (!d->key.isNull() && !d->tryLocker(&lock, function))
@@ -479,7 +481,7 @@ bool QSharedMemory::attach(AccessMode mode)
return false;
#ifndef QT_NO_SYSTEMSEMAPHORE
QSharedMemoryLocker lock(this);
- if (!d->key.isNull() && !d->tryLocker(&lock, QLatin1String("QSharedMemory::attach")))
+ if (!d->key.isNull() && !d->tryLocker(&lock, "QSharedMemory::attach"_L1))
return false;
#endif
@@ -519,7 +521,7 @@ bool QSharedMemory::detach()
#ifndef QT_NO_SYSTEMSEMAPHORE
QSharedMemoryLocker lock(this);
- if (!d->key.isNull() && !d->tryLocker(&lock, QLatin1String("QSharedMemory::detach")))
+ if (!d->key.isNull() && !d->tryLocker(&lock, "QSharedMemory::detach"_L1))
return false;
#endif
@@ -588,7 +590,7 @@ bool QSharedMemory::lock()
d->lockedByMe = true;
return true;
}
- QString function = QLatin1String("QSharedMemory::lock");
+ const auto function = "QSharedMemory::lock"_L1;
d->errorString = QSharedMemory::tr("%1: unable to lock").arg(function);
d->error = QSharedMemory::LockError;
return false;
@@ -610,7 +612,7 @@ bool QSharedMemory::unlock()
d->lockedByMe = false;
if (d->systemSemaphore.release())
return true;
- QString function = QLatin1String("QSharedMemory::unlock");
+ const auto function = "QSharedMemory::unlock"_L1;
d->errorString = QSharedMemory::tr("%1: unable to unlock").arg(function);
d->error = QSharedMemory::LockError;
return false;