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