diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2011-06-06 12:56:45 (GMT) |
---|---|---|
committer | Harald Fernengel <harald.fernengel@nokia.com> | 2011-06-06 12:56:45 (GMT) |
commit | 8eaf39f705295f3072e9243f55063e92af40489c (patch) | |
tree | 89c4b637555128f79958e924652339d3cb2f99b2 /src/corelib | |
parent | 11bacd30967435a54eb74e9e2e36a97b12629a8c (diff) | |
download | Qt-8eaf39f705295f3072e9243f55063e92af40489c.zip Qt-8eaf39f705295f3072e9243f55063e92af40489c.tar.gz Qt-8eaf39f705295f3072e9243f55063e92af40489c.tar.bz2 |
simplify QSharedMemoryPrivate::cleanHandle()
by making it return nothing as it's result should be ignored anyways
(initKey() and detach() could return false because of it - which is wrong)
Merge-request: 1248
Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qsharedmemory.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_p.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_symbian.cpp | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_unix.cpp | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qsharedmemory_win.cpp | 12 |
5 files changed, 10 insertions, 14 deletions
diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index 9ab9fa4..2882279 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -253,8 +253,8 @@ void QSharedMemory::setNativeKey(const QString &key) bool QSharedMemoryPrivate::initKey() { - if (!cleanHandle()) - return false; + cleanHandle(); + #ifndef QT_NO_SYSTEMSEMAPHORE systemSemaphore.setKey(QString(), 1); systemSemaphore.setKey(key, 1); diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h index 182876b..8099e6b 100644 --- a/src/corelib/kernel/qsharedmemory_p.h +++ b/src/corelib/kernel/qsharedmemory_p.h @@ -137,7 +137,7 @@ public: key_t handle(); #endif bool initKey(); - bool cleanHandle(); + void cleanHandle(); bool create(int size); bool attach(QSharedMemory::AccessMode mode); bool detach(); diff --git a/src/corelib/kernel/qsharedmemory_symbian.cpp b/src/corelib/kernel/qsharedmemory_symbian.cpp index 3430aaa..cd1567a 100644 --- a/src/corelib/kernel/qsharedmemory_symbian.cpp +++ b/src/corelib/kernel/qsharedmemory_symbian.cpp @@ -110,10 +110,9 @@ key_t QSharedMemoryPrivate::handle() return 1; } -bool QSharedMemoryPrivate::cleanHandle() +void QSharedMemoryPrivate::cleanHandle() { chunk.Close(); - return true; } bool QSharedMemoryPrivate::create(int size) diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index ae199c4..e991ce9 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -173,10 +173,9 @@ int QSharedMemoryPrivate::createUnixKeyFile(const QString &fileName) #ifndef QT_NO_SHAREDMEMORY -bool QSharedMemoryPrivate::cleanHandle() +void QSharedMemoryPrivate::cleanHandle() { unix_key = 0; - return true; } bool QSharedMemoryPrivate::create(int size) diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index d4da30d..3b8876f 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -125,15 +125,11 @@ HANDLE QSharedMemoryPrivate::handle() return hand; } -bool QSharedMemoryPrivate::cleanHandle() +void QSharedMemoryPrivate::cleanHandle() { - if (hand != 0 && !CloseHandle(hand)) { - hand = 0; + if (hand != 0 && !CloseHandle(hand)) setErrorString(QLatin1String("QSharedMemory::cleanHandle")); - return false; - } hand = 0; - return true; } bool QSharedMemoryPrivate::create(int size) @@ -192,7 +188,9 @@ bool QSharedMemoryPrivate::detach() size = 0; // close handle - return cleanHandle(); + cleanHandle(); + + return true; } QT_END_NAMESPACE |