summaryrefslogtreecommitdiffstats
path: root/src/corelib/ipc/qtipccommon_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/ipc/qtipccommon_p.h')
-rw-r--r--src/corelib/ipc/qtipccommon_p.h44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/corelib/ipc/qtipccommon_p.h b/src/corelib/ipc/qtipccommon_p.h
index 13c76671f6..72762c5ba7 100644
--- a/src/corelib/ipc/qtipccommon_p.h
+++ b/src/corelib/ipc/qtipccommon_p.h
@@ -31,25 +31,33 @@ QT_BEGIN_NAMESPACE
class QNativeIpcKeyPrivate
{
public:
- QNativeIpcKey::Type type = {};
+ QString legacyKey_;
- friend bool operator==(const QNativeIpcKeyPrivate &lhs, const QNativeIpcKeyPrivate &rhs)
+ static QString legacyKey(const QNativeIpcKey &key)
{
- return lhs.type == rhs.type;
+ if (key.isSlowPath())
+ return key.d->legacyKey_;
+ return QString();
+ }
+ static void setLegacyKey(QNativeIpcKey &key, const QString &legacyKey)
+ {
+ QNativeIpcKeyPrivate::makeExtended(key)->legacyKey_ = legacyKey;
+ }
+ static void setNativeAndLegacyKeys(QNativeIpcKey &key, const QString &nativeKey,
+ const QString &legacyKey)
+ {
+ key.setNativeKey(nativeKey);
+ setLegacyKey(key, legacyKey);
}
-};
-
-inline QNativeIpcKeyPrivate *QNativeIpcKey::d_func()
-{
- Q_ASSERT(d & 1); // Q_ASSERT(isSlowPath) but without the unlikely
- return reinterpret_cast<QNativeIpcKeyPrivate *>(d & ~1);
-}
-inline const QNativeIpcKeyPrivate *QNativeIpcKey::d_func() const
-{
- Q_ASSERT(d & 1); // Q_ASSERT(isSlowPath) but without the unlikely
- return reinterpret_cast<QNativeIpcKeyPrivate *>(d & ~1);
-}
+private:
+ static QNativeIpcKeyPrivate *makeExtended(QNativeIpcKey &key)
+ {
+ if (!key.isSlowPath())
+ key.d = new QNativeIpcKeyPrivate;
+ return key.d;
+ }
+};
namespace QtIpcCommon {
enum class IpcType {
@@ -136,10 +144,8 @@ public:
}
};
-Q_AUTOTEST_EXPORT QString
-legacyPlatformSafeKey(const QString &key, IpcType ipcType,
- QNativeIpcKey::Type type = QNativeIpcKey::legacyDefaultTypeForOs());
-Q_AUTOTEST_EXPORT QString platformSafeKey(const QString &key, IpcType ipcType, QNativeIpcKey::Type type);
+QNativeIpcKey legacyPlatformSafeKey(const QString &key, IpcType ipcType, QNativeIpcKey::Type type);
+QNativeIpcKey platformSafeKey(const QString &key, IpcType ipcType, QNativeIpcKey::Type type);
#ifdef Q_OS_UNIX
// Convenience function to create the file if needed