diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp index c874e5a6b4..ff9936d335 100644 --- a/src/corelib/mimetypes/qmimetypeparser.cpp +++ b/src/corelib/mimetypes/qmimetypeparser.cpp @@ -131,7 +131,7 @@ QMimeTypeParserBase::ParseState QMimeTypeParserBase::nextState(ParseState curren case ParseMagicMatchRule: if (startElement == QLatin1String(mimeTypeTagC)) // Sequence of return ParseMimeType; - if (startElement == QLatin1String(commentTagC )) + if (startElement == QLatin1String(commentTagC)) return ParseComment; if (startElement == QLatin1String(genericIconTagC)) return ParseGenericIcon; @@ -174,7 +174,8 @@ bool QMimeTypeParserBase::parseNumber(QStringView n, int *target, QString *error } #ifndef QT_NO_XMLSTREAMREADER -struct CreateMagicMatchRuleResult { +struct CreateMagicMatchRuleResult +{ QString errorMessage; // must be first QMimeMagicRule rule; diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp index 13eee3539e..777eed3c34 100644 --- a/src/corelib/plugin/qelfparser_p.cpp +++ b/src/corelib/plugin/qelfparser_p.cpp @@ -69,7 +69,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library qDebug() << "QElfParser::parse " << library; #endif - if (fdlen < 64){ + if (fdlen < 64) { if (lib) lib->errorString = QLibrary::tr("'%1' is not an ELF object (%2)").arg(library, QLibrary::tr("file too small")); return NotElf; @@ -129,7 +129,7 @@ int QElfParser::parse(const char *dataStart, ulong fdlen, const QString &library qelfhalf_t e_shentsize = read (data); - if (e_shentsize % 4){ + if (e_shentsize % 4) { if (lib) lib->errorString = QLibrary::tr("'%1' is an invalid ELF object (%2)").arg(library, QLibrary::tr("unexpected e_shentsize")); return Corrupt; diff --git a/src/corelib/plugin/qelfparser_p.h b/src/corelib/plugin/qelfparser_p.h index cdf055329d..72ee30d282 100644 --- a/src/corelib/plugin/qelfparser_p.h +++ b/src/corelib/plugin/qelfparser_p.h @@ -56,7 +56,7 @@ QT_REQUIRE_CONFIG(library); -#if defined (Q_OF_ELF) && defined(Q_CC_GNU) +#if defined(Q_OF_ELF) && defined(Q_CC_GNU) QT_BEGIN_NAMESPACE @@ -72,7 +72,7 @@ class QElfParser { public: enum { QtMetaDataSection, NoQtSection, NotElf, Corrupt }; - enum {ElfLittleEndian = 0, ElfBigEndian = 1}; + enum { ElfLittleEndian = 0, ElfBigEndian = 1 }; struct ElfSectionHeader { diff --git a/src/corelib/plugin/qfactoryinterface.h b/src/corelib/plugin/qfactoryinterface.h index 3aec4ddd55..86a1c8315f 100644 --- a/src/corelib/plugin/qfactoryinterface.h +++ b/src/corelib/plugin/qfactoryinterface.h @@ -45,7 +45,6 @@ QT_BEGIN_NAMESPACE - struct Q_CORE_EXPORT QFactoryInterface { virtual ~QFactoryInterface(); diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 259673b7d0..c2221d362f 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -141,7 +141,7 @@ class QFactoryLoaderPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QFactoryLoader) public: - QFactoryLoaderPrivate(){} + QFactoryLoaderPrivate() { } QByteArray iid; #if QT_CONFIG(library) ~QFactoryLoaderPrivate(); diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 1b759dd579..fcda933fd5 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -286,7 +286,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib) pos += rel; hasMetaData = true; } -#elif defined (Q_OF_MACH_O) +#elif defined(Q_OF_MACH_O) { QString errorString; int r = QMachOParser::parse(filedata, fdlen, library, &errorString, &pos, &fdlen); @@ -382,7 +382,7 @@ private: static inline QLibraryStore *instance(); // all members and instance() are protected by qt_library_mutex - typedef QMap LibraryMap; + typedef QMap LibraryMap; LibraryMap libraryMap; }; @@ -608,8 +608,8 @@ bool QLibraryPrivate::unload(UnloadFlag flag) if (qt_debug_component()) qWarning() << "QLibraryPrivate::unload succeeded on" << fileName << (flag == NoUnloadSys ? "(faked)" : ""); - //when the library is unloaded, we release the reference on it so that 'this' - //can get deleted + // when the library is unloaded, we release the reference on it so that 'this' + // can get deleted libraryRefCount.deref(); pHnd.storeRelaxed(nullptr); instanceFactory.storeRelaxed(nullptr); @@ -772,7 +772,7 @@ void QLibraryPrivate::updatePluginState() } if (!success) { - if (errorString.isEmpty()){ + if (errorString.isEmpty()) { if (fileName.isEmpty()) errorString = QLibrary::tr("The shared library was not found."); else @@ -884,12 +884,11 @@ QLibrary::QLibrary(QObject *parent) : QObject(parent) suffix in accordance with the platform, e.g. ".so" on Unix, ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ -QLibrary::QLibrary(const QString& fileName, QObject *parent) : QObject(parent) +QLibrary::QLibrary(const QString &fileName, QObject *parent) : QObject(parent) { setFileName(fileName); } - /*! Constructs a library object with the given \a parent that will load the library specified by \a fileName and major version number \a verNum. @@ -900,7 +899,7 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent) : QObject(parent) suffix in accordance with the platform, e.g. ".so" on Unix, ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ -QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) : QObject(parent) +QLibrary::QLibrary(const QString &fileName, int verNum, QObject *parent) : QObject(parent) { setFileNameAndVersion(fileName, verNum); } @@ -915,7 +914,7 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) : QObje suffix in accordance with the platform, e.g. ".so" on Unix, ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ -QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent) +QLibrary::QLibrary(const QString &fileName, const QString &version, QObject *parent) : QObject(parent) { setFileNameAndVersion(fileName, version); @@ -935,7 +934,6 @@ QLibrary::~QLibrary() d->release(); } - /*! \property QLibrary::fileName \brief the file name of the library diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h index 135c9bbeed..ac59f45789 100644 --- a/src/corelib/plugin/qlibrary.h +++ b/src/corelib/plugin/qlibrary.h @@ -67,9 +67,9 @@ public: Q_FLAG(LoadHints) explicit QLibrary(QObject *parent = nullptr); - explicit QLibrary(const QString& fileName, QObject *parent = nullptr); - explicit QLibrary(const QString& fileName, int verNum, QObject *parent = nullptr); - explicit QLibrary(const QString& fileName, const QString &version, QObject *parent = nullptr); + explicit QLibrary(const QString &fileName, QObject *parent = nullptr); + explicit QLibrary(const QString &fileName, int verNum, QObject *parent = nullptr); + explicit QLibrary(const QString &fileName, const QString &version, QObject *parent = nullptr); ~QLibrary(); QFunctionPointer resolve(const char *symbol); @@ -92,6 +92,7 @@ public: void setLoadHints(LoadHints hints); LoadHints loadHints() const; + private: enum LoadStatusTag { NotLoaded, diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index a5c72f81d9..46139b760e 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -61,10 +61,10 @@ QT_BEGIN_NAMESPACE static QString qdlerror() { const char *err = dlerror(); - return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')'): QString(); + return err ? QLatin1Char('(') + QString::fromLocal8Bit(err) + QLatin1Char(')') : QString(); } -QStringList QLibraryPrivate::suffixes_sys(const QString& fullVersion) +QStringList QLibraryPrivate::suffixes_sys(const QString &fullVersion) { QStringList suffixes; #if defined(Q_OS_HPUX) @@ -266,7 +266,7 @@ bool QLibraryPrivate::load_sys() QByteArray utf8Bundle = fileName.toUtf8(); QCFType bundleUrl = CFURLCreateFromFileSystemRepresentation(NULL, reinterpret_cast(utf8Bundle.data()), utf8Bundle.length(), true); QCFType bundle = CFBundleCreate(NULL, bundleUrl); - if(bundle) { + if (bundle) { QCFType url = CFBundleCopyExecutableURL(bundle); char executableFile[FILENAME_MAX]; CFURLGetFileSystemRepresentation(url, true, reinterpret_cast(executableFile), FILENAME_MAX); @@ -320,7 +320,7 @@ Q_CORE_EXPORT QFunctionPointer qt_mac_resolve_sys(void *handle, const char *symb } #endif -QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) +QFunctionPointer QLibraryPrivate::resolve_sys(const char *symbol) { QFunctionPointer address = QFunctionPointer(dlsym(pHnd.loadAcquire(), symbol)); return address; diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index ef1b389adc..07f5a4b744 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -147,7 +147,7 @@ bool QLibraryPrivate::unload_sys() return true; } -QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol) +QFunctionPointer QLibraryPrivate::resolve_sys(const char *symbol) { FARPROC address = GetProcAddress(pHnd.loadAcquire(), symbol); return QFunctionPointer(address); diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index f957c75ab8..db8db85fc0 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -211,7 +211,6 @@ bool QPluginLoader::load() return d->loadPlugin(); } - /*! Unloads the plugin and returns \c true if the plugin could be unloaded; otherwise returns \c false. @@ -234,7 +233,7 @@ bool QPluginLoader::unload() did_load = false; return d->unload(); } - if (d) // Ouch + if (d) // Ouch d->errorString = tr("The plugin was not loaded."); return false; } @@ -347,7 +346,7 @@ void QPluginLoader::setFileName(const QString &fileName) #else if (qt_debug_component()) { qWarning("Cannot load %s into a statically linked Qt library.", - (const char*)QFile::encodeName(fileName)); + (const char *)QFile::encodeName(fileName)); } Q_UNUSED(fileName); #endif diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h index 81b78aa532..b242de2991 100644 --- a/src/corelib/plugin/qpluginloader.h +++ b/src/corelib/plugin/qpluginloader.h @@ -100,4 +100,4 @@ public: QT_END_NAMESPACE -#endif //QPLUGINLOADER_H +#endif // QPLUGINLOADER_H diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index fe6760c8d8..593b0c3be7 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -118,7 +118,6 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect return inst; } return 0; - } QT_END_NAMESPACE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index 4e093c0b7c..b27e746fd3 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -110,6 +110,6 @@ private: QT_END_NAMESPACE -#endif //Q_OS_WIN +#endif // Q_OS_WIN -#endif //QSYSTEMLIBRARY_P_H +#endif // QSYSTEMLIBRARY_P_H diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 77f60c516f..be67898f8a 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -58,7 +58,7 @@ void _q_toHex(char *&dst, Integral value) { value = qToBigEndian(value); - const char* p = reinterpret_cast(&value); + const char *p = reinterpret_cast(&value); for (uint i = 0; i < sizeof(Integral); ++i, dst += 2) { dst[0] = QtMiscUtils::toHexLower((p[i] >> 4) & 0xf); @@ -646,7 +646,7 @@ QString QUuid::toString(QUuid::StringFormat mode) const QByteArray QUuid::toByteArray(QUuid::StringFormat mode) const { QByteArray result(MaxStringUuidLength, Qt::Uninitialized); - const auto end = _q_uuidToHex(*this, const_cast(result.constData()), mode); + const auto end = _q_uuidToHex(*this, const_cast(result.constData()), mode); result.resize(end - result.constData()); return result; } @@ -687,7 +687,7 @@ QByteArray QUuid::toRfc4122() const { // we know how many bytes a UUID has, I hope :) QByteArray bytes(16, Qt::Uninitialized); - uchar *data = reinterpret_cast(bytes.data()); + uchar *data = reinterpret_cast(bytes.data()); qToBigEndian(data1, data); data += sizeof(quint32); @@ -717,7 +717,7 @@ QDataStream &operator<<(QDataStream &s, const QUuid &id) } else { // we know how many bytes a UUID has, I hope :) bytes = QByteArray(16, Qt::Uninitialized); - uchar *data = reinterpret_cast(bytes.data()); + uchar *data = reinterpret_cast(bytes.data()); qToLittleEndian(id.data1, data); data += sizeof(quint32); diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index bfea13f9fc..87966ad891 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -104,7 +104,7 @@ public: data1 = 0; data2 = 0; data3 = 0; - for(int i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) data4[i] = 0; } QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) noexcept @@ -169,7 +169,7 @@ public: data1 = guid.Data1; data2 = guid.Data2; data3 = guid.Data3; - for(int i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) data4[i] = guid.Data4[i]; } #endif @@ -213,7 +213,6 @@ public: return QUuid::createUuidV5(ns, baseData.toUtf8()); } - QUuid::Variant variant() const noexcept; QUuid::Version version() const noexcept; diff --git a/src/corelib/thread/qfuturesynchronizer.h b/src/corelib/thread/qfuturesynchronizer.h index 5006ebb9cf..f73041f6a7 100644 --- a/src/corelib/thread/qfuturesynchronizer.h +++ b/src/corelib/thread/qfuturesynchronizer.h @@ -105,7 +105,7 @@ public: } protected: - QList > m_futures; + QList> m_futures; bool m_cancelOnWait; }; diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h index aaf06de2b8..96a979e66b 100644 --- a/src/corelib/thread/qmutex_p.h +++ b/src/corelib/thread/qmutex_p.h @@ -90,7 +90,8 @@ public: QAtomicInt refCount; int id; - bool ref() { + bool ref() + { Q_ASSERT(refCount.loadRelaxed() >= 0); int c; do { @@ -101,7 +102,8 @@ public: Q_ASSERT(refCount.loadRelaxed() >= 0); return true; } - void deref() { + void deref() + { Q_ASSERT(refCount.loadRelaxed() >= 0); if (!refCount.deref()) release(); diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 2f6a7a18ba..5f80c73ba8 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -858,7 +858,7 @@ bool QThread::wait(QDeadlineTimer deadline) return false; } -bool QThread::event(QEvent* event) +bool QThread::event(QEvent *event) { return QObject::event(event); } diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 0a73bf8a36..6565b5777e 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -109,7 +109,8 @@ public: inline QPostEventList() : QList(), recursion(0), startOffset(0), insertionOffset(0) { } - void addEvent(const QPostEvent &ev) { + void addEvent(const QPostEvent &ev) + { int priority = ev.priority; if (isEmpty() || constLast().priority >= priority || @@ -125,6 +126,7 @@ public: insert(at, ev); } } + private: //hides because they do not keep that list sorted. addEvent must be used using QList::append; @@ -176,7 +178,7 @@ public: #ifdef Q_OS_WIN static unsigned int __stdcall start(void *) noexcept; - static void finish(void *, bool lockAnyway=true) noexcept; + static void finish(void *, bool lockAnyway = true) noexcept; Qt::HANDLE handle; unsigned int id; @@ -215,7 +217,7 @@ public: QThreadData *data; bool running = false; - static void setCurrentThread(QThread*) {} + static void setCurrentThread(QThread *) { } static QThread *threadForId(int) { return QThread::currentThread(); } static QAbstractEventDispatcher *createEventDispatcher(QThreadData *data); @@ -265,7 +267,7 @@ public: static const uint Count = 2; uint idx; - const char* locations[Count]; + const char *locations[Count]; public: FlaggedDebugSignatures() : idx(0) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 70c1eb4b62..f4d4914efc 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -235,7 +235,7 @@ void QAdoptedThread::init() */ extern "C" { -typedef void*(*QtThreadCallback)(void*); +typedef void *(*QtThreadCallback)(void *); } #endif // QT_CONFIG(thread) diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 1c1bf38f9b..99e33cab48 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -258,7 +258,7 @@ bool QThreadPoolPrivate::tooManyThreadsActive() const void QThreadPoolPrivate::startThread(QRunnable *runnable) { Q_ASSERT(runnable != nullptr); - QScopedPointer thread(new QThreadPoolThread(this)); + QScopedPointer thread(new QThreadPoolThread(this)); thread->setObjectName(QLatin1String("Thread (pooled)")); Q_ASSERT(!allThreads.contains(thread.data())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here) allThreads.insert(thread.data()); @@ -282,7 +282,7 @@ void QThreadPoolPrivate::reset() waitingThreads.clear(); mutex.unlock(); - for (QThreadPoolThread *thread: qAsConst(allThreadsCopy)) { + for (QThreadPoolThread *thread : qAsConst(allThreadsCopy)) { if (!thread->isFinished()) { thread->runnableReady.wakeAll(); thread->wait(); diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h index cb0896cb16..a559eff49a 100644 --- a/src/corelib/thread/qthreadpool.h +++ b/src/corelib/thread/qthreadpool.h @@ -51,7 +51,6 @@ QT_REQUIRE_CONFIG(thread); QT_BEGIN_NAMESPACE - class QThreadPoolPrivate; class Q_CORE_EXPORT QThreadPool : public QObject { diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h index f019b480f5..4d73a480b5 100644 --- a/src/corelib/thread/qthreadpool_p.h +++ b/src/corelib/thread/qthreadpool_p.h @@ -65,47 +65,44 @@ QT_BEGIN_NAMESPACE class QDeadlineTimer; -class QueuePage { +class QueuePage +{ public: enum { MaxPageSize = 256 }; - QueuePage(QRunnable *runnable, int pri) - : m_priority(pri) + QueuePage(QRunnable *runnable, int pri) : m_priority(pri) { push(runnable); } + + bool isFull() { return m_lastIndex >= MaxPageSize - 1; } + + bool isFinished() { return m_firstIndex > m_lastIndex; } + + void push(QRunnable *runnable) { - push(runnable); - } - - bool isFull() { - return m_lastIndex >= MaxPageSize - 1; - } - - bool isFinished() { - return m_firstIndex > m_lastIndex; - } - - void push(QRunnable *runnable) { Q_ASSERT(runnable != nullptr); Q_ASSERT(!isFull()); m_lastIndex += 1; m_entries[m_lastIndex] = runnable; } - void skipToNextOrEnd() { + void skipToNextOrEnd() + { while (!isFinished() && m_entries[m_firstIndex] == nullptr) { m_firstIndex += 1; } } - QRunnable *first() { + QRunnable *first() + { Q_ASSERT(!isFinished()); QRunnable *runnable = m_entries[m_firstIndex]; Q_ASSERT(runnable); return runnable; } - QRunnable *pop() { + QRunnable *pop() + { Q_ASSERT(!isFinished()); QRunnable *runnable = first(); Q_ASSERT(runnable); @@ -120,7 +117,8 @@ public: return runnable; } - bool tryTake(QRunnable *runnable) { + bool tryTake(QRunnable *runnable) + { Q_ASSERT(!isFinished()); for (int i = m_firstIndex; i <= m_lastIndex; i++) { if (m_entries[i] == runnable) { @@ -135,9 +133,7 @@ public: return false; } - int priority() const { - return m_priority; - } + int priority() const { return m_priority; } private: int m_priority = 0; diff --git a/src/corelib/thread/qthreadstorage.h b/src/corelib/thread/qthreadstorage.h index 9eb8672e92..b30e91c6c7 100644 --- a/src/corelib/thread/qthreadstorage.h +++ b/src/corelib/thread/qthreadstorage.h @@ -209,7 +209,7 @@ public: return qThreadStorage_hasLocalData(data); } - inline T& localData() + inline T &localData() { if (!data) data.reset(new T()); diff --git a/src/corelib/thread/qwaitcondition.h b/src/corelib/thread/qwaitcondition.h index 0a47ac3717..3d0117ad03 100644 --- a/src/corelib/thread/qwaitcondition.h +++ b/src/corelib/thread/qwaitcondition.h @@ -73,7 +73,7 @@ public: private: Q_DISABLE_COPY(QWaitCondition) - QWaitConditionPrivate * d; + QWaitConditionPrivate *d; }; #else diff --git a/src/corelib/thread/qwaitcondition_p.h b/src/corelib/thread/qwaitcondition_p.h index 5133e52e92..93ae628143 100644 --- a/src/corelib/thread/qwaitcondition_p.h +++ b/src/corelib/thread/qwaitcondition_p.h @@ -60,8 +60,7 @@ QT_BEGIN_NAMESPACE -namespace QtPrivate -{ +namespace QtPrivate { #if defined(Q_OS_INTEGRITY) @@ -70,6 +69,7 @@ class condition_variable; class mutex : private QMutex { friend class QtPrivate::condition_variable; + public: // all special member functions are ok! // do not expose the (QMutex::Recursive) ctor diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp index b663014761..01848a5004 100644 --- a/src/corelib/thread/qwaitcondition_unix.cpp +++ b/src/corelib/thread/qwaitcondition_unix.cpp @@ -114,7 +114,8 @@ void qt_abstime_for_timeout(timespec *ts, QDeadlineTimer deadline) #endif } -class QWaitConditionPrivate { +class QWaitConditionPrivate +{ public: pthread_mutex_t mutex; pthread_cond_t cond; @@ -169,7 +170,6 @@ public: } }; - QWaitCondition::QWaitCondition() { d = new QWaitConditionPrivate; @@ -178,7 +178,6 @@ QWaitCondition::QWaitCondition() d->waiters = d->wakeups = 0; } - QWaitCondition::~QWaitCondition() { report_error(pthread_cond_destroy(&d->cond), "QWaitCondition", "cv destroy"); @@ -211,7 +210,7 @@ bool QWaitCondition::wait(QMutex *mutex, unsigned long time) bool QWaitCondition::wait(QMutex *mutex, QDeadlineTimer deadline) { - if (! mutex) + if (!mutex) return false; report_error(pthread_mutex_lock(&d->mutex), "QWaitCondition::wait()", "mutex lock"); diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp index 04cfe16576..1529cda089 100644 --- a/src/corelib/thread/qwaitcondition_win.cpp +++ b/src/corelib/thread/qwaitcondition_win.cpp @@ -45,7 +45,7 @@ #include "qlist.h" #include "qalgorithms.h" -#define Q_MUTEX_T void* +#define Q_MUTEX_T void * #include #include #include @@ -87,7 +87,7 @@ QWaitConditionEvent *QWaitConditionPrivate::pre() { mtx.lock(); QWaitConditionEvent *wce = - freeQueue.isEmpty() ? new QWaitConditionEvent : freeQueue.takeFirst(); + freeQueue.isEmpty() ? new QWaitConditionEvent : freeQueue.takeFirst(); wce->priority = GetThreadPriority(GetCurrentThread()); wce->wokenUp = false; @@ -109,7 +109,8 @@ bool QWaitConditionPrivate::wait(QWaitConditionEvent *wce, unsigned long time) // wait for the event bool ret = false; switch (WaitForSingleObjectEx(wce->event, time, FALSE)) { - default: break; + default: + break; case WAIT_OBJECT_0: ret = true;