{QSharedMemory,QSystemSemaphore}Private: use NSDMI for the members
Change-Id: If4c23ea3719947d790d4fffd171524225cc125fc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
705665957b
commit
9536a0ad48
@ -8,15 +8,6 @@
|
|||||||
#if QT_CONFIG(sharedmemory)
|
#if QT_CONFIG(sharedmemory)
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QSharedMemoryPrivate::QSharedMemoryPrivate()
|
|
||||||
: QObjectPrivate(), memory(0), size(0), error(QSharedMemory::NoError),
|
|
||||||
#if QT_CONFIG(systemsemaphore)
|
|
||||||
systemSemaphore(QString()), lockedByMe(false),
|
|
||||||
#endif
|
|
||||||
unix_key(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSharedMemoryPrivate::setErrorString(QLatin1StringView function)
|
void QSharedMemoryPrivate::setErrorString(QLatin1StringView function)
|
||||||
{
|
{
|
||||||
Q_UNUSED(function);
|
Q_UNUSED(function);
|
||||||
|
@ -82,17 +82,15 @@ class Q_AUTOTEST_EXPORT QSharedMemoryPrivate : public QObjectPrivate
|
|||||||
Q_DECLARE_PUBLIC(QSharedMemory)
|
Q_DECLARE_PUBLIC(QSharedMemory)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSharedMemoryPrivate();
|
void *memory = nullptr;
|
||||||
|
qsizetype size = 0;
|
||||||
void *memory;
|
|
||||||
qsizetype size;
|
|
||||||
QString key;
|
QString key;
|
||||||
QString nativeKey;
|
QString nativeKey;
|
||||||
QSharedMemory::SharedMemoryError error;
|
QSharedMemory::SharedMemoryError error = QSharedMemory::NoError;
|
||||||
QString errorString;
|
QString errorString;
|
||||||
#if QT_CONFIG(systemsemaphore)
|
#if QT_CONFIG(systemsemaphore)
|
||||||
QSystemSemaphore systemSemaphore;
|
QSystemSemaphore systemSemaphore{QString()};
|
||||||
bool lockedByMe;
|
bool lockedByMe = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int createUnixKeyFile(const QString &fileName);
|
static int createUnixKeyFile(const QString &fileName);
|
||||||
@ -126,11 +124,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
Qt::HANDLE hand;
|
Qt::HANDLE hand = nullptr;
|
||||||
#elif defined(QT_POSIX_IPC)
|
#elif defined(QT_POSIX_IPC)
|
||||||
int hand;
|
int hand = -1;
|
||||||
#else
|
#else
|
||||||
key_t unix_key;
|
key_t unix_key = 0;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,19 +28,6 @@
|
|||||||
#if QT_CONFIG(sharedmemory)
|
#if QT_CONFIG(sharedmemory)
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QSharedMemoryPrivate::QSharedMemoryPrivate() :
|
|
||||||
memory(nullptr), size(0), error(QSharedMemory::NoError),
|
|
||||||
#if QT_CONFIG(systemsemaphore)
|
|
||||||
systemSemaphore(QString()), lockedByMe(false),
|
|
||||||
#endif
|
|
||||||
#ifndef QT_POSIX_IPC
|
|
||||||
unix_key(0)
|
|
||||||
#else
|
|
||||||
hand(-1)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSharedMemoryPrivate::setErrorString(QLatin1StringView function)
|
void QSharedMemoryPrivate::setErrorString(QLatin1StringView function)
|
||||||
{
|
{
|
||||||
// EINVAL is handled in functions so they can give better error strings
|
// EINVAL is handled in functions so they can give better error strings
|
||||||
|
@ -13,12 +13,6 @@ using namespace Qt::StringLiterals;
|
|||||||
|
|
||||||
#if QT_CONFIG(sharedmemory)
|
#if QT_CONFIG(sharedmemory)
|
||||||
|
|
||||||
QSharedMemoryPrivate::QSharedMemoryPrivate() :
|
|
||||||
memory(0), size(0), error(QSharedMemory::NoError),
|
|
||||||
systemSemaphore(QString()), lockedByMe(false), hand(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSharedMemoryPrivate::setErrorString(QLatin1StringView function)
|
void QSharedMemoryPrivate::setErrorString(QLatin1StringView function)
|
||||||
{
|
{
|
||||||
DWORD windowsError = GetLastError();
|
DWORD windowsError = GetLastError();
|
||||||
|
@ -10,12 +10,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QSystemSemaphorePrivate::QSystemSemaphorePrivate() :
|
|
||||||
unix_key(-1), semaphore(-1), createdFile(false),
|
|
||||||
createdSemaphore(false), error(QSystemSemaphore::NoError)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSystemSemaphorePrivate::setErrorString(const QString &function)
|
void QSystemSemaphorePrivate::setErrorString(const QString &function)
|
||||||
{
|
{
|
||||||
Q_UNUSED(function);
|
Q_UNUSED(function);
|
||||||
|
@ -32,7 +32,6 @@ class QSystemSemaphorePrivate
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSystemSemaphorePrivate();
|
|
||||||
|
|
||||||
QString makeKeyFileName()
|
QString makeKeyFileName()
|
||||||
{
|
{
|
||||||
@ -61,18 +60,18 @@ public:
|
|||||||
QString fileName;
|
QString fileName;
|
||||||
int initialValue;
|
int initialValue;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
Qt::HANDLE semaphore;
|
Qt::HANDLE semaphore = nullptr;
|
||||||
#elif defined(QT_POSIX_IPC)
|
#elif defined(QT_POSIX_IPC)
|
||||||
sem_t *semaphore;
|
sem_t *semaphore = SEM_FAILED;
|
||||||
bool createdSemaphore;
|
bool createdSemaphore = false;
|
||||||
#else
|
#else
|
||||||
key_t unix_key;
|
key_t unix_key = -1;
|
||||||
int semaphore;
|
int semaphore = -1;
|
||||||
bool createdFile;
|
bool createdFile = false;
|
||||||
bool createdSemaphore;
|
bool createdSemaphore = false;
|
||||||
#endif
|
#endif
|
||||||
QString errorString;
|
QString errorString;
|
||||||
QSystemSemaphore::SystemSemaphoreError error;
|
QSystemSemaphore::SystemSemaphoreError error = QSystemSemaphore::NoError;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -21,16 +21,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QSystemSemaphorePrivate::QSystemSemaphorePrivate() :
|
|
||||||
#ifndef QT_POSIX_IPC
|
|
||||||
unix_key(-1), semaphore(-1), createdFile(false),
|
|
||||||
#else
|
|
||||||
semaphore(SEM_FAILED),
|
|
||||||
#endif // QT_POSIX_IPC
|
|
||||||
createdSemaphore(false), error(QSystemSemaphore::NoError)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSystemSemaphorePrivate::setErrorString(const QString &function)
|
void QSystemSemaphorePrivate::setErrorString(const QString &function)
|
||||||
{
|
{
|
||||||
// EINVAL is handled in functions so they can give better error strings
|
// EINVAL is handled in functions so they can give better error strings
|
||||||
|
@ -13,11 +13,6 @@ using namespace Qt::StringLiterals;
|
|||||||
|
|
||||||
#if QT_CONFIG(systemsemaphore)
|
#if QT_CONFIG(systemsemaphore)
|
||||||
|
|
||||||
QSystemSemaphorePrivate::QSystemSemaphorePrivate() :
|
|
||||||
semaphore(0), error(QSystemSemaphore::NoError)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QSystemSemaphorePrivate::setErrorString(const QString &function)
|
void QSystemSemaphorePrivate::setErrorString(const QString &function)
|
||||||
{
|
{
|
||||||
BOOL windowsError = GetLastError();
|
BOOL windowsError = GetLastError();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user