From 28d14bcc32fb81895eb8ce90d5b733d1372b7edf Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sun, 16 Jun 2019 17:15:47 -0400 Subject: [PATCH] dont bother comparing to nullptr --- GUI/extenwindow.cpp | 2 +- GUI/host/host.cpp | 2 +- extensions/extension.h | 2 +- extensions/extrawindow.cpp | 4 ++-- extensions/lua.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GUI/extenwindow.cpp b/GUI/extenwindow.cpp index 28e4fb3..dfd343b 100644 --- a/GUI/extenwindow.cpp +++ b/GUI/extenwindow.cpp @@ -118,7 +118,7 @@ bool ExtenWindow::eventFilter(QObject* target, QEvent* event) void ExtenWindow::keyPressEvent(QKeyEvent* event) { - if (event->key() == Qt::Key_Delete && ui->extenList->currentItem() != nullptr) + if (event->key() == Qt::Key_Delete && ui->extenList->currentItem()) { Unload(ui->extenList->currentIndex().row()); Sync(); diff --git a/GUI/host/host.cpp b/GUI/host/host.cpp index 00985c6..eb9f1a0 100644 --- a/GUI/host/host.cpp +++ b/GUI/host/host.cpp @@ -29,7 +29,7 @@ namespace TextHook GetHook(uint64_t addr) { - if (view == nullptr) return {}; + if (!view) return {}; std::scoped_lock lock(viewMutex); for (auto hook : view) if (hook.address == addr) return hook; diff --git a/extensions/extension.h b/extensions/extension.h index b7f5a8f..a8925e6 100644 --- a/extensions/extension.h +++ b/extensions/extension.h @@ -14,7 +14,7 @@ struct SentenceInfo // nullptr marks end of info array int64_t operator[](std::string propertyName) { - for (auto info = infoArray; info->name != nullptr; ++info) if (propertyName == info->name) return info->value; + for (auto info = infoArray; info->name; ++info) if (propertyName == info->name) return info->value; throw; } diff --git a/extensions/extrawindow.cpp b/extensions/extrawindow.cpp index d0f9508..28b352f 100644 --- a/extensions/extrawindow.cpp +++ b/extensions/extrawindow.cpp @@ -136,7 +136,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved case DLL_PROCESS_DETACH: { std::lock_guard l(m); - if (window != nullptr) + if (window) { window->settings->setValue(WINDOW, window->geometry()); window->settings->sync(); @@ -155,7 +155,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) { std::lock_guard l(m); - if (window == nullptr || !sentenceInfo["current select"]) return false; + if (!window || !sentenceInfo["current select"]) return false; QMetaObject::invokeMethod(window, [=] { window->display->setText(QString::fromStdWString(sentence)); }); return false; } diff --git a/extensions/lua.cpp b/extensions/lua.cpp index c1ed1af..5c0eabc 100644 --- a/extensions/lua.cpp +++ b/extensions/lua.cpp @@ -127,7 +127,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) } lua_pushstring(L, WideStringToString(sentence).c_str()); lua_createtable(L, 0, 0); - for (auto info = sentenceInfo.infoArray; info->name != nullptr; ++info) + for (auto info = sentenceInfo.infoArray; info->name; ++info) { lua_pushstring(L, info->name); lua_pushinteger(L, info->value);