From e2150d04662a4ba8b5304dabcc74be0bacded5b7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Jan 2011 01:07:47 +0200 Subject: Fix code style, apply some fixes after checking with cppcheck from git. --- src/net/download.cpp | 1 + src/net/manaserv/attributes.cpp | 8 ++++---- src/net/manaserv/charhandler.cpp | 4 ++-- src/net/manaserv/loginhandler.cpp | 5 ++++- src/net/messagein.cpp | 1 + src/net/tmwa/buysellhandler.cpp | 1 + src/net/tmwa/gamehandler.cpp | 1 + src/net/tmwa/guildhandler.h | 2 +- src/net/tmwa/inventoryhandler.cpp | 4 +++- src/net/tmwa/network.cpp | 4 ++-- 10 files changed, 20 insertions(+), 11 deletions(-) (limited to 'src/net') diff --git a/src/net/download.cpp b/src/net/download.cpp index 2d391b783..882cc76d3 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -71,6 +71,7 @@ Download::Download(void *ptr, const std::string &url, mUrl(url), mFileName(""), mWriteFunction(NULL), + mAdler(0), mUpdateFunction(updateFunction), mThread(NULL), mCurl(NULL), diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp index 7cc0e053d..7802376ff 100644 --- a/src/net/manaserv/attributes.cpp +++ b/src/net/manaserv/attributes.cpp @@ -93,7 +93,7 @@ namespace Attributes attributeLabels.clear(); AttributeMap::const_iterator it, it_end; for (it = attributes.begin(), it_end = attributes.end(); - it != it_end; it++) + it != it_end; ++it) { if (it->second.modifiable && (it->second.scope == "character" || it->second.scope == "being")) @@ -288,7 +288,7 @@ namespace Attributes unsigned int count = 0; for_each_xml_child_node(effectNode, node) - { + { if (!xmlStrEqual(effectNode->name, BAD_CAST "modifier")) continue; ++count; @@ -307,7 +307,7 @@ namespace Attributes tag = name.substr(0, name.size() > 3 ? 3 : name.size()); tag = toLower(tag) + toString(count); - } + } std::string effect = XML::getProperty( effectNode, "effect", ""); @@ -395,7 +395,7 @@ namespace Attributes AttributeMap::const_iterator it, it_end; for (it = attributes.begin(), it_end = attributes.end(); - it != it_end; it++) + it != it_end; ++it) { if (it->second.playerInfoId == -1 && (it->second.scope == "character" diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index dd5430c03..adc3b206c 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -321,7 +321,7 @@ void CharHandler::newCharacter(const std::string &name, msg.writeInt8(slot); std::vector::const_iterator it, it_end; - for (it = stats.begin(), it_end = stats.end(); it != it_end; it++) + for (it = stats.begin(), it_end = stats.end(); it != it_end; ++it) msg.writeInt16((*it)); accountServerConnection->send(msg); @@ -382,7 +382,7 @@ void CharHandler::updateCharacters() character->data.mAttributes[CORR_POINTS] = info.correctionPoints; for (CachedAttributes::const_iterator it = info.attribute.begin(), - it_end = info.attribute.end(); it != it_end; it++) + it_end = info.attribute.end(); it != it_end; ++it) { character->data.mStats[i].base = it->second.base; character->data.mStats[i].mod = it->second.mod; diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp index 1588d762d..bd67967a0 100644 --- a/src/net/manaserv/loginhandler.cpp +++ b/src/net/manaserv/loginhandler.cpp @@ -58,6 +58,8 @@ LoginHandler::LoginHandler() }; handledMessages = _messages; loginHandler = this; + mMinUserNameLength = 4; + mMaxUserNameLength = 10; } void LoginHandler::handleMessage(Net::MessageIn &msg) @@ -232,7 +234,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) std::string captchaURL = msg.readString(); std::string captchaInstructions = msg.readString(); - printf("%s: %s\n", captchaURL.c_str(), captchaInstructions.c_str()); + printf("%s: %s\n", captchaURL.c_str(), + captchaInstructions.c_str()); Client::setState(STATE_REGISTER); } diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 0ac391ee2..79beeacf4 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -37,6 +37,7 @@ namespace Net MessageIn::MessageIn(const char *data, unsigned int length): mData(data), mLength(length), + mId(0), mPos(0) { PacketCounters::incInPackets(); diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 84a02e92a..02613cebd 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -65,6 +65,7 @@ BuySellHandler::BuySellHandler() mNpcId = 0; handledMessages = _messages; buySellHandler = this; + mBuyDialog = 0; } void BuySellHandler::handleMessage(Net::MessageIn &msg) diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 5f949ce6e..e35a31898 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -59,6 +59,7 @@ GameHandler::GameHandler() }; handledMessages = _messages; gameHandler = this; + mCharID = 0; listen(CHANNEL_GAME); } diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index 80b03bd01..d1f19d37c 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -76,7 +76,7 @@ class GuildHandler : public Net::GuildHandler, public MessageHandler private: // TmwAthena (and eAthena) only supports one guild per player - Guild *mGuild; +// Guild *mGuild; }; } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 186f9ceb3..ad5ff4fff 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -372,9 +372,11 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) InventoryItems::iterator it = mInventoryItems.begin(); InventoryItems::iterator it_end = mInventoryItems.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) + { mStorage->setItem((*it).slot, (*it).id, (*it).quantity, (*it).equip); + } mInventoryItems.clear(); if (!mStorageWindow) diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 7aa9ad7d2..b96cfd2b5 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -290,12 +290,12 @@ void Network::skip(int len) bool Network::messageReady() { - int len = -1, msgId; + int len = -1; SDL_mutexP(mMutex); if (mInSize >= 2) { - msgId = readWord(0); + int msgId = readWord(0); if (msgId == SMSG_SERVER_VERSION_RESPONSE) len = 10; else -- cgit v1.2.3-70-g09d2