From 5acadea119fc2a89e944dc9431e298e5e9544770 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 2 Dec 2011 23:06:48 +0300 Subject: Fix some issues after automatic code checking. --- src/being.cpp | 3 +-- src/gui/botcheckerwindow.cpp | 4 ++-- src/gui/widgets/chattab.cpp | 3 +-- src/guichan/gui.cpp | 16 ++++++++-------- src/net/tmwa/playerhandler.cpp | 2 +- src/utils/base64.cpp | 3 ++- 6 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index 31f1eac59..185891509 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -2527,10 +2527,9 @@ void Being::updatePercentHP() { if (!mMaxHP || !serverVersion) return; - unsigned num = 0; if (mHP) { - num = mHP * 100 / mMaxHP; + unsigned num = mHP * 100 / mMaxHP; if (num != mNumber) { mNumber = num; diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index bff9ad31a..2043b4fe3 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -193,14 +193,14 @@ public: attackBot = true; // attacking but not talking more than 2 minutes - if (talk > 2 * 60 && talk > 2 * 60) + if (talk > 2 * 60) { talkBot = true; str += toString((talk) / 60) + " "; } // attacking but not moving more than 2 minutes - if (move > 2 * 60 && move > 2 * 60) + if (move > 2 * 60) { moveBot = true; str += toString((move) / 60); diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 0a224605a..72af1b0b8 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -205,8 +205,7 @@ void ChatTab::chatLog(std::string line, Own own, // if configured, move magic messages log to debug chat tab if (localChatTab && this == localChatTab - && ((config.getBoolValue("showMagicInDebug") - && own == BY_PLAYER && tmp.text.length() > 1 + && ((config.getBoolValue("showMagicInDebug") && own == BY_PLAYER && tmp.text.length() > 1 && tmp.text.at(0) == '#' && tmp.text.at(1) != '#') || (config.getBoolValue("serverMsgInDebug") && (own == BY_SERVER diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp index 810a983c4..3f5581424 100644 --- a/src/guichan/gui.cpp +++ b/src/guichan/gui.cpp @@ -417,7 +417,7 @@ namespace gcn while (parent) { - parent = (Widget*)widget->getParent(); + parent = static_cast(widget->getParent()); // Check if the widget is present in the "widget with mouse" queue. bool widgetIsPresentInQueue = false; @@ -450,7 +450,7 @@ namespace gcn Widget* swap = widget; widget = parent; - parent = (Widget*)swap->getParent(); + parent = static_cast(swap->getParent()); } if (mFocusHandler->getDraggedWidget()) @@ -683,7 +683,7 @@ namespace gcn if (!Widget::widgetExists(widget)) break; - parent = (Widget*)widget->getParent(); + parent = static_cast(widget->getParent()); if (widget->isEnabled() || force) { @@ -742,7 +742,7 @@ namespace gcn Widget* swap = widget; widget = parent; - parent = (Widget*)swap->getParent(); + parent = static_cast(swap->getParent()); // If a non modal focused widget has been reach // and we have modal focus cancel the distribution. @@ -786,7 +786,7 @@ namespace gcn if (!Widget::widgetExists(widget)) break; - parent = (Widget*)widget->getParent(); + parent = static_cast(widget->getParent()); if (widget->isEnabled()) { @@ -815,7 +815,7 @@ namespace gcn Widget* swap = widget; widget = parent; - parent = (Widget*)swap->getParent(); + parent = static_cast(swap->getParent()); // If a non modal focused widget has been reach // and we have modal focus cancel the distribution. @@ -928,7 +928,7 @@ namespace gcn while (parent) { - parent = (Widget*)widget->getParent(); + parent = static_cast(widget->getParent()); // Check if the widget is present in the "widget with mouse" queue. bool widgetIsPresentInQueue = false; @@ -960,7 +960,7 @@ namespace gcn Widget* swap = widget; widget = parent; - parent = (Widget*)swap->getParent(); + parent = static_cast(swap->getParent()); } } } diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index 20156d8cb..c678fe09d 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -232,7 +232,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) while (buf - start + 1 < size && *(buf + 1)) { - char status = *buf; // now unused +// char status = *buf; // now unused buf ++; arr.push_back(buf); buf += strlen(buf) + 1; diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 843a0b534..24a3a58e3 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -108,7 +108,8 @@ unsigned char *php3_base64_decode(const unsigned char *string, /* run through the whole string, converting as we go */ while ((ch = *current++) != '\0') { - if (ch == base64_pad) break; + if (ch == base64_pad) + break; /* When Base64 gets POSTed, all pluses are interpreted as spaces. This line changes them back. It's not exactly the Base64 spec, -- cgit v1.2.3-60-g2f50