diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-11-22 14:46:58 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-12-06 12:13:20 +0100 |
commit | ece0c0a5e7e0b18beb58ccd868bde54c7be64f78 (patch) | |
tree | fa4a0fdbda040d24f1a2d07a320635c76980f431 /src/corelib/plugin/qlibrary.cpp | |
parent | b19220d17fa66de5ded41690ffff263ee2af5c63 (diff) |
Tidy nullptr usage
Move away from using 0 as pointer literal.
Done using clang-tidy. This is not complete as
run-clang-tidy can't handle all of qtbase in one go.
Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/plugin/qlibrary.cpp')
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index eeaa3c18ec..b3a95d4f26 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -256,7 +256,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib) qsizetype fdlen = qMin(file.size(), MaxMemoryMapSize); const char *filedata = reinterpret_cast<char *>(file.map(0, fdlen)); - if (filedata == 0) { + if (filedata == nullptr) { // Try reading the data into memory instead (up to 64 MB). data = file.read(64 * 1024 * 1024); filedata = data.constData(); @@ -387,12 +387,12 @@ private: }; static QBasicMutex qt_library_mutex; -static QLibraryStore *qt_library_data = 0; +static QLibraryStore *qt_library_data = nullptr; static bool qt_library_data_once; QLibraryStore::~QLibraryStore() { - qt_library_data = 0; + qt_library_data = nullptr; } inline void QLibraryStore::cleanup() @@ -459,7 +459,7 @@ inline QLibraryPrivate *QLibraryStore::findOrCreate(const QString &fileName, con QLibraryStore *data = instance(); // check if this library is already loaded - QLibraryPrivate *lib = 0; + QLibraryPrivate *lib = nullptr; if (Q_LIKELY(data)) { lib = data->libraryMap.value(fileName); if (lib) @@ -498,7 +498,7 @@ inline void QLibraryStore::releaseLibrary(QLibraryPrivate *lib) } QLibraryPrivate::QLibraryPrivate(const QString &canonicalFileName, const QString &version, QLibrary::LoadHints loadHints) - : pHnd(0), fileName(canonicalFileName), fullVersion(version), instance(0), + : pHnd(nullptr), fileName(canonicalFileName), fullVersion(version), instance(nullptr), libraryRefCount(0), libraryUnloadCount(0), pluginState(MightBeAPlugin) { loadHintsInt.storeRelaxed(loadHints); @@ -528,7 +528,7 @@ void QLibraryPrivate::mergeLoadHints(QLibrary::LoadHints lh) QFunctionPointer QLibraryPrivate::resolve(const char *symbol) { if (!pHnd) - return 0; + return nullptr; return resolve_sys(symbol); } @@ -584,12 +584,12 @@ bool QLibraryPrivate::unload(UnloadFlag flag) //when the library is unloaded, we release the reference on it so that 'this' //can get deleted libraryRefCount.deref(); - pHnd = 0; - instance = 0; + pHnd = nullptr; + instance = nullptr; } } - return (pHnd == 0); + return (pHnd == nullptr); } void QLibraryPrivate::release() @@ -847,7 +847,7 @@ bool QLibrary::isLoaded() const Constructs a library with the given \a parent. */ QLibrary::QLibrary(QObject *parent) - :QObject(parent), d(0), did_load(false) + :QObject(parent), d(nullptr), did_load(false) { } @@ -862,7 +862,7 @@ QLibrary::QLibrary(QObject *parent) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, QObject *parent) - :QObject(parent), d(0), did_load(false) + :QObject(parent), d(nullptr), did_load(false) { setFileName(fileName); } @@ -879,7 +879,7 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) - :QObject(parent), d(0), did_load(false) + :QObject(parent), d(nullptr), did_load(false) { setFileNameAndVersion(fileName, verNum); } @@ -895,7 +895,7 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent) ".dylib" on \macos and iOS, and ".dll" on Windows. (See \l{fileName}.) */ QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent) - :QObject(parent), d(0), did_load(false) + :QObject(parent), d(nullptr), did_load(false) { setFileNameAndVersion(fileName, version); } @@ -942,7 +942,7 @@ void QLibrary::setFileName(const QString &fileName) if (d) { lh = d->loadHints(); d->release(); - d = 0; + d = nullptr; did_load = false; } d = QLibraryPrivate::findOrCreate(fileName, QString(), lh); @@ -970,7 +970,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, int verNum) if (d) { lh = d->loadHints(); d->release(); - d = 0; + d = nullptr; did_load = false; } d = QLibraryPrivate::findOrCreate(fileName, verNum >= 0 ? QString::number(verNum) : QString(), lh); @@ -991,7 +991,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, const QString &ver if (d) { lh = d->loadHints(); d->release(); - d = 0; + d = nullptr; did_load = false; } d = QLibraryPrivate::findOrCreate(fileName, version, lh); @@ -1020,7 +1020,7 @@ void QLibrary::setFileNameAndVersion(const QString &fileName, const QString &ver QFunctionPointer QLibrary::resolve(const char *symbol) { if (!isLoaded() && !load()) - return 0; + return nullptr; return d->resolve(symbol); } |