From 158e2b5eb03ae01bf5c49f87292bf7aca8ae749b Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Fri, 29 Sep 2017 18:40:47 +0300
Subject: Fix code style.

---
 src/eventsmanager.cpp                |  5 +++--
 src/gui/gui.cpp                      |  3 ++-
 src/gui/windows/killstats.cpp        | 11 +++++++----
 src/gui/windows/killstats.h          |  2 +-
 src/gui/windows/ministatuswindow.cpp |  1 -
 src/net/eathena/charserverrecv.cpp   |  3 ++-
 src/net/protocoloutupdate.h          |  2 +-
 7 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp
index 1ca458366..bf463a0c2 100644
--- a/src/eventsmanager.cpp
+++ b/src/eventsmanager.cpp
@@ -512,13 +512,14 @@ void EventsManager::logEvent(const SDL_Event &event)
         {
 #ifdef USE_X11
             const bool res = X11Logger::logEvent(event);
+            if (res == false)
+                logger->assertLog("event: SDL_SYSWMEVENT: not supported:");
 #else  // USE_X11
 
             const bool res = false;
+            logger->assertLog("event: SDL_SYSWMEVENT: not supported:");
 #endif  // USE_X11
 
-            if (res == false)
-                logger->assertLog("event: SDL_SYSWMEVENT: not supported:");
             break;
         }
         case SDL_USEREVENT:
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c5d6bc95c..3fab73d0a 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -1467,7 +1467,8 @@ void Gui::handleModalFocusReleased()
     Widget* widget = getMouseEventSource(mLastMouseX, mLastMouseY);
     Widget* parent = widget;
 
-    while (parent != nullptr)
+    while (parent != nullptr &&
+           widget != nullptr)
     {
         parent = widget->getParent();
 
diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp
index 1b83b1001..80efb4b36 100644
--- a/src/gui/windows/killstats.cpp
+++ b/src/gui/windows/killstats.cpp
@@ -295,7 +295,7 @@ void KillStats::gainXp(int64_t xp)
     // TRANSLATORS: kill stats window label
     mLine7->setCaption(strprintf(_("Kills/Min: %s, Exp/Min: %s"),
         toString(mKillTCounter / timeDiff).c_str(),
-        toString(mExpTCounter / timeDiff).c_str()));
+        toString(CAST_U64(mExpTCounter / timeDiff)).c_str()));
 
     mLastKillExpLabel->setCaption(strprintf("%s %s",
         // TRANSLATORS: kill stats window label
@@ -314,7 +314,8 @@ void KillStats::recalcStats()
     // Need Update Exp Counter
     if (curTime - m1minExpTime > 60)
     {
-        const int64_t newExp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP);
+        const int64_t newExp = PlayerInfo::getAttribute(
+            Attributes::PLAYER_EXP);
         if (m1minExpTime != 0)
             m1minSpeed = CAST_S32(newExp - m1minExpNum);
         else
@@ -335,7 +336,8 @@ void KillStats::recalcStats()
 
     if (curTime - m5minExpTime > 60*5)
     {
-        const int64_t newExp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP);
+        const int64_t newExp = PlayerInfo::getAttribute(
+            Attributes::PLAYER_EXP);
         if (m5minExpTime != 0)
             m5minSpeed = CAST_S32(newExp - m5minExpNum);
         else
@@ -346,7 +348,8 @@ void KillStats::recalcStats()
 
     if (curTime - m15minExpTime > 60*15)
     {
-        const int64_t newExp = PlayerInfo::getAttribute(Attributes::PLAYER_EXP);
+        const int64_t newExp = PlayerInfo::getAttribute(
+            Attributes::PLAYER_EXP);
         if (m15minExpTime != 0)
             m15minSpeed = CAST_S32(newExp - m15minExpNum);
         else
diff --git a/src/gui/windows/killstats.h b/src/gui/windows/killstats.h
index a57c5c439..c701d8430 100644
--- a/src/gui/windows/killstats.h
+++ b/src/gui/windows/killstats.h
@@ -96,7 +96,7 @@ class KillStats final : public Window,
         int mKillCounter;   /**< Session Kill counter. */
         int64_t mExpCounter;  /**< Session Exp counter. */
         int mKillTCounter;   /**< Timer Kill counter. */
-        int mExpTCounter;    /**< Timer Exp counter. */
+        int64_t mExpTCounter;    /**< Timer Exp counter. */
 
         time_t m1minExpTime;
         int64_t m1minExpNum;
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index 212906861..e596f1fae 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -415,7 +415,6 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event)
             Attributes::PLAYER_JOB_LEVEL);
         const std::string expStr = toString(CAST_U64(exp));
         const std::string expNeedStr = toString(CAST_U64(expNeed));
-        const std::string jobLevelStr = toString(CAST_U64(jobLevel));
         const std::string expLeftStr = toString(CAST_U64(expNeed - exp));
 
         // TRANSLATORS: job bar label
diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp
index 8e64385ef..ec906f081 100644
--- a/src/net/eathena/charserverrecv.cpp
+++ b/src/net/eathena/charserverrecv.cpp
@@ -101,7 +101,8 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg,
         data.mAttributes[Attributes::PLAYER_JOB_EXP] =
             msg.readInt32("job exp");
     }
-    data.mAttributes[Attributes::PLAYER_JOB_LEVEL] =msg.readInt32("job level");
+    data.mAttributes[Attributes::PLAYER_JOB_LEVEL] =
+        msg.readInt32("job level");
 
     msg.readInt16("shoes?");
     const int gloves = msg.readInt16("gloves");
diff --git a/src/net/protocoloutupdate.h b/src/net/protocoloutupdate.h
index f6f7a62b2..ea142a69d 100644
--- a/src/net/protocoloutupdate.h
+++ b/src/net/protocoloutupdate.h
@@ -22,7 +22,7 @@
 #define NET_PROTOCOLOUTUPDATE_H
 
 #define packet(name, id, sz, comment) name = id
-#define packet2(name, id, sz, comment) name = id + evolPacketOffset
+#define packet2(name, id, sz, comment) name = (id) + evolPacketOffset
 #define PROTOCOLOUTUPDATE_VOID
 
 #endif  // NET_PROTOCOLOUTUPDATE_H
-- 
cgit v1.2.3-70-g09d2