From c519372dbf9cfeb1fc45e633d2f4870f494fca8f Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Wed, 17 Aug 2022 20:08:07 +0800 Subject: [PATCH] QSystemLibrary: Replace 0 with nullptr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use modern C++ more. Change-Id: I8ba2a6e95187976b7e4077bb39f05eab04a8575f Reviewed-by: MÃ¥rten Nordheim --- src/corelib/plugin/qsystemlibrary.cpp | 4 ++-- src/corelib/plugin/qsystemlibrary_p.h | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp index dfca23ca3a..503bb25206 100644 --- a/src/corelib/plugin/qsystemlibrary.cpp +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -80,10 +80,10 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect } fullPathAttempt.append(fileName); HINSTANCE inst = ::LoadLibrary(reinterpret_cast(fullPathAttempt.utf16())); - if (inst != 0) + if (inst != nullptr) return inst; } - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index c24caf3c2e..ebdcaa7b74 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -28,14 +28,14 @@ public: explicit QSystemLibrary(const QString &libraryName) { m_libraryName = libraryName; - m_handle = 0; + m_handle = nullptr; m_didLoad = false; } explicit QSystemLibrary(const wchar_t *libraryName) { m_libraryName = QString::fromWCharArray(libraryName); - m_handle = 0; + m_handle = nullptr; m_didLoad = false; } @@ -43,12 +43,12 @@ public: { m_handle = load((const wchar_t *)m_libraryName.utf16(), onlySystemDirectory); m_didLoad = true; - return (m_handle != 0); + return (m_handle != nullptr); } bool isLoaded() { - return (m_handle != 0); + return (m_handle != nullptr); } QFunctionPointer resolve(const char *symbol) @@ -56,7 +56,7 @@ public: if (!m_didLoad) load(); if (!m_handle) - return 0; + return nullptr; return QFunctionPointer(GetProcAddress(m_handle, symbol)); }