diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-20 11:03:48 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-21 08:53:38 +0200 |
commit | 1be271713ebcbca2f2cc1dd8734f2740165dab96 (patch) | |
tree | f39c4c241bae383427d466e6225889ab3e91efea /src/corelib/plugin | |
parent | 3e09ac369dc8e2851ff772b9d9dde92fffd959b2 (diff) |
Whitespace cleanup in corelib/ mimetypes, plugin and thread
Done with selective application of clang-format
Change-Id: Iee6bf2426de81356b6d480629ba972f980b6d93d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r-- | src/corelib/plugin/qelfparser_p.cpp | 4 | ||||
-rw-r--r-- | src/corelib/plugin/qelfparser_p.h | 4 | ||||
-rw-r--r-- | src/corelib/plugin/qfactoryinterface.h | 1 | ||||
-rw-r--r-- | src/corelib/plugin/qfactoryloader.cpp | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 18 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary.h | 7 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary_unix.cpp | 8 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qpluginloader.cpp | 5 | ||||
-rw-r--r-- | src/corelib/plugin/qpluginloader.h | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qsystemlibrary.cpp | 1 | ||||
-rw-r--r-- | src/corelib/plugin/qsystemlibrary_p.h | 4 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.cpp | 8 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.h | 5 |
14 files changed, 33 insertions, 38 deletions
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<qelfhalf_t> (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<QString, QLibraryPrivate*> LibraryMap; + typedef QMap<QString, QLibraryPrivate *> 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<CFURLRef> bundleUrl = CFURLCreateFromFileSystemRepresentation(NULL, reinterpret_cast<const UInt8*>(utf8Bundle.data()), utf8Bundle.length(), true); QCFType<CFBundleRef> bundle = CFBundleCreate(NULL, bundleUrl); - if(bundle) { + if (bundle) { QCFType<CFURLRef> url = CFBundleCopyExecutableURL(bundle); char executableFile[FILENAME_MAX]; CFURLGetFileSystemRepresentation(url, true, reinterpret_cast<UInt8*>(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<const char*>(&value); + const char *p = reinterpret_cast<const char *>(&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<char*>(result.constData()), mode); + const auto end = _q_uuidToHex(*this, const_cast<char *>(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<uchar*>(bytes.data()); + uchar *data = reinterpret_cast<uchar *>(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<uchar*>(bytes.data()); + uchar *data = reinterpret_cast<uchar *>(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; |