QSystemLibrary: Replace 0 with nullptr

Use modern C++ more.

Change-Id: I8ba2a6e95187976b7e4077bb39f05eab04a8575f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Yuhang Zhao 2022-08-17 20:08:07 +08:00
parent c51c4aa2c5
commit c519372dbf
2 changed files with 7 additions and 7 deletions

View File

@ -80,10 +80,10 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect
} }
fullPathAttempt.append(fileName); fullPathAttempt.append(fileName);
HINSTANCE inst = ::LoadLibrary(reinterpret_cast<const wchar_t *>(fullPathAttempt.utf16())); HINSTANCE inst = ::LoadLibrary(reinterpret_cast<const wchar_t *>(fullPathAttempt.utf16()));
if (inst != 0) if (inst != nullptr)
return inst; return inst;
} }
return 0; return nullptr;
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -28,14 +28,14 @@ public:
explicit QSystemLibrary(const QString &libraryName) explicit QSystemLibrary(const QString &libraryName)
{ {
m_libraryName = libraryName; m_libraryName = libraryName;
m_handle = 0; m_handle = nullptr;
m_didLoad = false; m_didLoad = false;
} }
explicit QSystemLibrary(const wchar_t *libraryName) explicit QSystemLibrary(const wchar_t *libraryName)
{ {
m_libraryName = QString::fromWCharArray(libraryName); m_libraryName = QString::fromWCharArray(libraryName);
m_handle = 0; m_handle = nullptr;
m_didLoad = false; m_didLoad = false;
} }
@ -43,12 +43,12 @@ public:
{ {
m_handle = load((const wchar_t *)m_libraryName.utf16(), onlySystemDirectory); m_handle = load((const wchar_t *)m_libraryName.utf16(), onlySystemDirectory);
m_didLoad = true; m_didLoad = true;
return (m_handle != 0); return (m_handle != nullptr);
} }
bool isLoaded() bool isLoaded()
{ {
return (m_handle != 0); return (m_handle != nullptr);
} }
QFunctionPointer resolve(const char *symbol) QFunctionPointer resolve(const char *symbol)
@ -56,7 +56,7 @@ public:
if (!m_didLoad) if (!m_didLoad)
load(); load();
if (!m_handle) if (!m_handle)
return 0; return nullptr;
return QFunctionPointer(GetProcAddress(m_handle, symbol)); return QFunctionPointer(GetProcAddress(m_handle, symbol));
} }