From 36ba43d6ea38062b17f7e63ef659962bfc51c64d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Jun 2017 23:34:34 +0300 Subject: Fix clang-tidy check readability-implicit-bool-cast. --- src/gui/windows/serverdialog.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/gui/windows/serverdialog.cpp') diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index a86fa0b1e..51f937666 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -199,7 +199,7 @@ void ServerDialog::postInit() ServerDialog::~ServerDialog() { - if (mDownload) + if (mDownload != nullptr) { mDownload->cancel(); delete2(mDownload) @@ -216,7 +216,7 @@ void ServerDialog::connectToSelectedServer() if (index < 0) return; - if (mDownload) + if (mDownload != nullptr) mDownload->cancel(); mQuitButton->setEnabled(false); @@ -244,7 +244,7 @@ void ServerDialog::connectToSelectedServer() settings.supportUrl = mServerInfo->supportUrl; settings.updateMirrors = mServerInfo->updateMirrors; - if (chatLogger) + if (chatLogger != nullptr) chatLogger->setServerName(mServerInfo->hostname); saveCustomServers(*mServerInfo); @@ -254,7 +254,7 @@ void ServerDialog::connectToSelectedServer() if (mServerInfo->hostname != LoginDialog::savedPasswordKey) { LoginDialog::savedPassword.clear(); - if (desktop) + if (desktop != nullptr) desktop->reloadWallpaper(); } } @@ -433,7 +433,7 @@ void ServerDialog::downloadServerList() if (listFile.empty()) listFile = "http://manaplus.org/serverlist.xml"; - if (mDownload) + if (mDownload != nullptr) { mDownload->cancel(); delete2(mDownload) @@ -485,7 +485,7 @@ void ServerDialog::loadServers(const bool addNew) SkipError_false); XmlNodeConstPtr rootNode = doc.rootNode(); - if (!rootNode || !xmlNameEqual(rootNode, "serverlist")) + if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "serverlist")) { logger->log1("Error loading server list!"); return; @@ -663,7 +663,7 @@ void ServerDialog::loadCustomServers() server.hostname = config.getValue(hostKey, ""); server.type = ServerInfo::parseType(config.getValue(typeKey, "")); server.persistentIp = config.getValue( - persistentIpKey, 0) ? true : false; + persistentIpKey, 0) != 0 ? true : false; server.packetVersion = config.getValue(packetVersionKey, 0); const int defaultPort = defaultPortForServerType(server.type); @@ -747,13 +747,13 @@ int ServerDialog::downloadUpdate(void *ptr, size_t total, const size_t remaining) { - if (!ptr || status == DownloadStatus::Cancelled) + if ((ptr == nullptr) || status == DownloadStatus::Cancelled) return -1; ServerDialog *const sd = reinterpret_cast(ptr); bool finished = false; - if (!sd->mDownload) + if (sd->mDownload == nullptr) return -1; if (status == DownloadStatus::Complete) @@ -769,7 +769,7 @@ int ServerDialog::downloadUpdate(void *ptr, else { float progress = static_cast(remaining); - if (total) + if (total != 0u) progress /= static_cast(total); if (progress != progress || progress < 0.0F) @@ -809,7 +809,7 @@ bool ServerDialog::needUpdateServers() const void ServerDialog::close() { - if (mDownload) + if (mDownload != nullptr) mDownload->cancel(); client->setState(State::FORCE_QUIT); Window::close(); -- cgit v1.2.3-70-g09d2