From 8660f14a94af91d42d3c8aae1b370f47cad9720b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 14 Aug 2017 19:10:55 +0300 Subject: Fix some pointer to bool conversions. --- src/game.cpp | 4 ++-- src/gui/popupmanager.cpp | 2 +- src/gui/windowmanager.cpp | 4 ++-- src/gui/windows/chatwindow.cpp | 2 +- src/gui/windows/statuswindow.cpp | 2 +- src/resources/db/itemdb.cpp | 2 +- src/utils/stringutils.cpp | 10 +++++----- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index b1687e953..08f123bce 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -200,7 +200,7 @@ static void createGuiWindows() // Create dialogs CREATEWIDGETV0(emoteWindow, EmoteWindow); delete2(debugChatTab) - if (chatWindow) + if (chatWindow != nullptr) { chatWindow->scheduleDelete(); chatWindow = nullptr; @@ -227,7 +227,7 @@ static void createGuiWindows() CREATEWIDGETV0(shopWindow, ShopWindow); CREATEWIDGETV0(skillDialog, SkillDialog); CREATEWIDGETV0(minimap, Minimap); - if (debugWindow) + if (debugWindow != nullptr) { debugWindow->scheduleDelete(); debugWindow = nullptr; diff --git a/src/gui/popupmanager.cpp b/src/gui/popupmanager.cpp index 3aed639e9..134aaac7b 100644 --- a/src/gui/popupmanager.cpp +++ b/src/gui/popupmanager.cpp @@ -76,7 +76,7 @@ void PopupManager::hidePopupMenu() void PopupManager::hideItemPopup() { #ifndef DYECMD - if (itemPopup) + if (itemPopup != nullptr) itemPopup->hide(); #endif // DYECMD } diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 978e6ae42..ab4224f25 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -133,7 +133,7 @@ void WindowManager::createWindows() CREATEWIDGETV0(spellPopup, SpellPopup); CREATEWIDGETV0(skillPopup, SkillPopup); delete2(debugChatTab); - if (chatWindow) + if (chatWindow != nullptr) { chatWindow->scheduleDelete(); chatWindow = nullptr; @@ -145,7 +145,7 @@ void WindowManager::createWindows() "#Debug", ChatTabType::DEBUG); debugChatTab->setAllowHighlight(false); chatWindow->setVisible(Visible_false); - if (debugWindow) + if (debugWindow != nullptr) { debugWindow->scheduleDelete(); debugWindow = nullptr; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 0c7123631..7992c6262 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -670,7 +670,7 @@ void ChatWindow::chatInput(const std::string &message) const if (tab != nullptr) tab->chatInput(msg); Game *const game = Game::instance(); - if (game) + if (game != nullptr) game->setValidSpeed(); } diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 3dc7110b9..520bdefd0 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -260,7 +260,7 @@ void StatusWindow::addTabBasic(const std::string &name) void StatusWindow::updateLevelLabel() { - if (!localPlayer) + if (localPlayer != nullptr) return; const int groupId = localPlayer->getGroupId(); diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index e27290413..f54f5075b 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -530,7 +530,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, effect.append(" / "); effect.append(temp); - if (inheritItemInfo) + if (inheritItemInfo != nullptr) { if (view == 0) view = inheritItemInfo->getView(); diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 2d91509c8..8920d111b 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -799,7 +799,7 @@ std::string toString(uint32_t num) size_t idx = 28; do buf[idx--] = CAST_8((num % 10) + '0'); - while (num /= 10); + while ((num /= 10) != 0); return buf + idx + 1; } @@ -810,7 +810,7 @@ std::string toString(uint64_t num) size_t idx = 98; do buf[idx--] = CAST_8((num % 10) + '0'); - while (num /= 10); + while ((num /= 10) != 0); return buf + idx + 1; } @@ -821,7 +821,7 @@ std::string toString(uint16_t num) size_t idx = 8; do buf[idx--] = CAST_8((num % 10) + '0'); - while (num /= 10); + while ((num /= 10) != 0); return buf + idx + 1; } @@ -832,7 +832,7 @@ std::string toString(unsigned char num) size_t idx = 3; do buf[idx--] = CAST_8((num % 10) + '0'); - while (num /= 10); + while ((num /= 10) != 0); return buf + idx + 1; } @@ -850,7 +850,7 @@ std::string toString(int32_t num) } do buf[idx--] = CAST_8((num % 10) + '0'); - while (num /= 10); + while ((num /= 10) != 0); if (useSign) buf[idx--] = '-'; return buf + idx + 1; -- cgit v1.2.3-70-g09d2