From b10c6ee0b9c8428f9ed426357a58aa42ee14cbfe Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 15 Sep 2017 22:40:40 +0300 Subject: Fix code style. --- src/eventsmanager.cpp | 9 ++++++--- src/gui/palette.cpp | 3 +-- src/gui/widgets/setupitem.cpp | 2 +- src/gui/windows/whoisonline.h | 2 +- src/input/inputactionmap.h | 1 - src/net/eathena/mail2recv.cpp | 2 +- src/net/ipc.cpp | 5 +++-- src/resources/atlas/atlasmanager.h | 6 +++--- src/resources/resourcemanager/resourcemanager.cpp | 3 +-- 9 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp index 41f2a8f3e..1ca458366 100644 --- a/src/eventsmanager.cpp +++ b/src/eventsmanager.cpp @@ -510,9 +510,11 @@ void EventsManager::logEvent(const SDL_Event &event) break; case SDL_SYSWMEVENT: { - bool res = false; #ifdef USE_X11 - res = X11Logger::logEvent(event); + const bool res = X11Logger::logEvent(event); +#else // USE_X11 + + const bool res = false; #endif // USE_X11 if (res == false) @@ -532,7 +534,8 @@ void EventsManager::logEvent(const SDL_Event &event) #endif // ANDROID default: - logger->assertLog("event: other: %u", event.type); + logger->assertLog("event: other: %u", + CAST_U32(event.type)); break; }; } diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index c7bd7612e..7fcf153fe 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -194,7 +194,6 @@ void Palette::advanceGradient() } } - if (advance != 0) - mRainbowTime = tick_time; + mRainbowTime = tick_time; } } diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 67d52ec0e..cc6ded02e 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -830,7 +830,7 @@ void SetupItemDropDownStr::fromWidget() const int sel = mDropDown->getSelected(); // use first element in model as empty string if (sel == 0 || sel >= mModel->getNumberOfElements()) - mValue = ""; + mValue.clear(); else mValue = mModel->getElementAt(sel); } diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h index 0eb316197..afdb43785 100644 --- a/src/gui/windows/whoisonline.h +++ b/src/gui/windows/whoisonline.h @@ -163,7 +163,7 @@ class WhoIsOnline final : public Window, int mDownloadedBytes; /** Status of the current download. */ - DownloadStatus mDownloadStatus; + WhoIsOnline::DownloadStatus mDownloadStatus; /** Flag that show if current download is complete. */ bool mDownloadComplete; diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 7bdfe7553..0c81000bc 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -295,7 +295,6 @@ static const InputActionData inputActionData InputCondition::KEY_DOWN | InputCondition::GAME | InputCondition::NOTARGET | - InputCondition::KEY_DOWN | InputCondition::NOBLOCK, "sit", UseArgs_false, diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp index 536425386..1afb69d16 100644 --- a/src/net/eathena/mail2recv.cpp +++ b/src/net/eathena/mail2recv.cpp @@ -346,7 +346,7 @@ void Mail2Recv::processMailListPage(Net::MessageIn &msg) mail->type = static_cast( msg.readUInt8("type")); mail->sender = msg.readString(24, "sender name"); - mail->time = cur_time - msg.readInt32("reg time"); + mail->time = CAST_S32(cur_time - msg.readInt32("reg time")); mail->strTime = timeToStr(mail->time); mail->expireTime = msg.readInt32("expire time"); mail->title = msg.readString(-1, "title"); diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp index 407f8ca3b..2f910eaed 100644 --- a/src/net/ipc.cpp +++ b/src/net/ipc.cpp @@ -165,8 +165,9 @@ void IPC::start() return; unsigned short port(44007); - if (getenv("IPC_PORT") != nullptr) - port = static_cast(atoi(getenv("IPC_PORT"))); + const char *const portStr = getenv("IPC_PORT"); + if (portStr != nullptr) + port = static_cast(atoi(portStr)); logger->log("Starting IPC..."); ipc = new IPC; diff --git a/src/resources/atlas/atlasmanager.h b/src/resources/atlas/atlasmanager.h index 1e5de93b9..4db0d1e4e 100644 --- a/src/resources/atlas/atlasmanager.h +++ b/src/resources/atlas/atlasmanager.h @@ -23,13 +23,13 @@ #ifdef USE_OPENGL -#include "resources/image/image.h" - #include "utils/stringvector.h" +#include "localconsts.h" + class AtlasResource; +class Image; -struct AtlasItem; struct TextureAtlas; class AtlasManager final diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index cdbc7f5cd..98c9baab5 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -22,8 +22,6 @@ #include "resources/resourcemanager/resourcemanager.h" -#include "configuration.h" - #ifdef USE_OPENGL #include "resources/image/image.h" #endif // USE_OPENGL @@ -37,6 +35,7 @@ #include "utils/cast.h" #include "utils/checkutils.h" #include "utils/foreach.h" +#include "utils/stringutils.h" #if !defined(DEBUG_DUMP_LEAKS) && !defined(UNITTESTS) #include "resources/resourcetypes.h" -- cgit v1.2.3-70-g09d2