From 499e1c831b9afd3f6bc02cb90d8a9a861e2b84a3 Mon Sep 17 00:00:00 2001 From: zergtmn Date: Thu, 16 Feb 2012 20:31:48 +0600 Subject: [PATCH] [11928] Some warning fixes --- src/game/DBCStores.cpp | 2 +- src/game/GameObject.cpp | 5 +---- src/game/Group.cpp | 2 +- src/game/Group.h | 2 +- src/game/GroupHandler.cpp | 11 +++-------- src/game/ObjectMgr.cpp | 2 +- src/game/Pet.cpp | 2 +- src/game/PlayerDump.cpp | 10 +++++----- src/game/Spell.cpp | 3 --- src/game/SpellAuras.cpp | 2 +- src/game/SpellEffects.cpp | 3 +-- src/game/ThreatManager.cpp | 2 +- src/game/UnitAuraProcHandler.cpp | 3 +++ src/shared/Database/Database.cpp | 4 ++-- src/shared/Database/DatabaseMysql.cpp | 2 +- src/shared/Database/DatabaseMysql.h | 5 ++--- src/shared/Util.cpp | 4 ++-- src/shared/revision_nr.h | 2 +- 18 files changed, 28 insertions(+), 38 deletions(-) diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 3fdd364ec7f..154f3494085 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -338,7 +338,7 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err if(f) { char buf[100]; - snprintf(buf,100," (exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?",storage.GetFieldCount(),strlen(storage.GetFormat())); + snprintf(buf, 100, " (exist, but have %u fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat())); errlist.push_back(dbc_filename + buf); fclose(f); } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 11fcd32ee36..8238bf5a6d1 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -1510,11 +1510,8 @@ void GameObject::Use(Unit* user) switch(info->id) { case 179785: // Silverwing Flag - // check if it's correct bg - if (bg->GetTypeID() == BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag(player, this); - break; case 179786: // Warsong Flag + // check if it's correct bg if (bg->GetTypeID() == BATTLEGROUND_WS) bg->EventPlayerClickedOnFlag(player, this); break; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index daa78ff7f80..5ca0c87e96e 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1677,7 +1677,7 @@ bool Group::InCombatToInstance(uint32 instanceId) return false; } -bool Group::SetPlayerMap(const ObjectGuid guid, uint32 mapid) +bool Group::SetPlayerMap(ObjectGuid guid, uint32 mapid) { member_witerator slot = _getMemberWSlot(guid); if (slot != m_memberSlots.end()) diff --git a/src/game/Group.h b/src/game/Group.h index 5599ea9b082..678eef07ecc 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -339,7 +339,7 @@ class MANGOS_DLL_SPEC Group void RewardGroupAtKill(Unit* pVictim, Player* player_tap); - bool SetPlayerMap(const ObjectGuid guid, uint32 mapid); + bool SetPlayerMap(ObjectGuid guid, uint32 mapid); /*********************************************************/ /*** LOOT SYSTEM ***/ diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 4f5ff33e904..0a7dd564db0 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -679,15 +679,10 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke if (mask & GROUP_UPDATE_FLAG_STATUS) { - if (player) - { - if (player->IsPvP()) - *data << uint16(MEMBER_STATUS_ONLINE | MEMBER_STATUS_PVP); - else - *data << uint16(MEMBER_STATUS_ONLINE); - } + if (player->IsPvP()) + *data << uint16(MEMBER_STATUS_ONLINE | MEMBER_STATUS_PVP); else - *data << uint16(MEMBER_STATUS_OFFLINE); + *data << uint16(MEMBER_STATUS_ONLINE); } if (mask & GROUP_UPDATE_FLAG_CUR_HP) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 92827d3889c..c966206422b 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -8031,7 +8031,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const // explicit name case std::wstring wname; if(!Utf8toWStr(name,wname)) - return false; + return NULL; // converting string that we try to find to lower case wstrToLower( wname ); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 6d1c353ad4b..6c3cfef7a22 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -951,7 +951,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner) int32 createResistance[MAX_SPELL_SCHOOL] = {0,0,0,0,0,0,0}; - if(cinfo && getPetType() != HUNTER_PET) + if(getPetType() != HUNTER_PET) { createResistance[SPELL_SCHOOL_HOLY] = cinfo->resistance1; createResistance[SPELL_SCHOOL_FIRE] = cinfo->resistance2; diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 94532888614..424c7060610 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -185,7 +185,7 @@ bool changeGuid(std::string &str, int n, std::map &guidMap, uint return true; // not an error uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid); - snprintf(chritem, 20, "%d", newGuid); + snprintf(chritem, 20, "%u", newGuid); return changenth(str, n, chritem, false, nonzero); } @@ -198,7 +198,7 @@ bool changetokGuid(std::string &str, int n, std::map &guidMap, u return true; // not an error uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid); - snprintf(chritem, 20, "%d", newGuid); + snprintf(chritem, 20, "%u", newGuid); return changetoknth(str, n, chritem, false, nonzero); } @@ -453,9 +453,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s // name encoded or empty - snprintf(newguid, 20, "%d", guid); - snprintf(chraccount, 20, "%d", account); - snprintf(newpetid, 20, "%d", sObjectMgr.GeneratePetNumber()); + snprintf(newguid, 20, "%u", guid); + snprintf(chraccount, 20, "%u", account); + snprintf(newpetid, 20, "%u", sObjectMgr.GeneratePetNumber()); snprintf(lastpetid, 20, "%s", ""); std::map items; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index a784d80961b..ab9f141276e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4807,10 +4807,7 @@ SpellCastResult Spell::CheckCast(bool strict) else return SPELL_FAILED_BAD_TARGETS; } - } - if(non_caster_target) - { // simple cases bool explicit_target_mode = false; bool target_hostile = false; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index a22c81617fc..06b75aa23e0 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -670,7 +670,7 @@ void AreaAura::Update(uint32 diff) } } - for(Spell::UnitList::iterator tIter = targets.begin(); tIter != targets.end(); tIter++) + for(Spell::UnitList::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) { // flag for seelction is need apply aura to current iteration target bool apply = true; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 19ebb791788..cd1971c38a7 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4247,8 +4247,7 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype) pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetObjectGuid()); // send info to the client - if(pItem) - player->SendNewItem(pItem, num_to_add, true, !bg_mark); + player->SendNewItem(pItem, num_to_add, true, !bg_mark); // we succeeded in creating at least one item, so a levelup is possible if(!bg_mark) diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index 3593bd3a920..72b9cff2f06 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -295,7 +295,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile bool checkedCurrentVictim = false; ThreatList::const_iterator lastRef = iThreatList.end(); - lastRef--; + --lastRef; for (ThreatList::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) { diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 6bf9ee0916d..f0c6bed50a5 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -2457,6 +2457,9 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura // Improved Water Shield if (dummySpell->SpellIconID == 2287) { + if (!procSpell) + return SPELL_AURA_PROC_FAILED; + // Lesser Healing Wave need aditional 60% roll if ((procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080)) && !roll_chance_i(60)) return SPELL_AURA_PROC_FAILED; diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 7206ff4b936..3eb582ea813 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -307,7 +307,7 @@ QueryResult* Database::PQuery(const char *format,...) if(res==-1) { sLog.outError("SQL Query truncated (and not execute) for format: %s",format); - return false; + return NULL; } return Query(szQuery); @@ -326,7 +326,7 @@ QueryNamedResult* Database::PQueryNamed(const char *format,...) if(res==-1) { sLog.outError("SQL Query truncated (and not execute) for format: %s",format); - return false; + return NULL; } return QueryNamed(szQuery); diff --git a/src/shared/Database/DatabaseMysql.cpp b/src/shared/Database/DatabaseMysql.cpp index 21cdbd818ec..99b297f3220 100644 --- a/src/shared/Database/DatabaseMysql.cpp +++ b/src/shared/Database/DatabaseMysql.cpp @@ -337,7 +337,7 @@ bool MySqlPreparedStatement::prepare() m_stmt = mysql_stmt_init(m_pMySQLConn); if (!m_stmt) { - sLog.outError("SQL: mysql_stmt_init()() failed "); + sLog.outError("SQL: mysql_stmt_init() failed "); return false; } diff --git a/src/shared/Database/DatabaseMysql.h b/src/shared/Database/DatabaseMysql.h index d2dbad69fc4..78f47f12983 100644 --- a/src/shared/Database/DatabaseMysql.h +++ b/src/shared/Database/DatabaseMysql.h @@ -72,6 +72,8 @@ class MANGOS_DLL_SPEC MySQLConnection : public SqlConnection MySQLConnection(Database& db) : SqlConnection(db), mMysql(NULL) {} ~MySQLConnection(); + //! Initializes Mysql and connects to a server. + /*! infoString should be formated like hostname;username;password;database. */ bool Initialize(const char *infoString); QueryResult* Query(const char *sql); @@ -102,9 +104,6 @@ class MANGOS_DLL_SPEC DatabaseMysql : public Database DatabaseMysql(); ~DatabaseMysql(); - //! Initializes Mysql and connects to a server. - /*! infoString should be formated like hostname;username;password;database. */ - // must be call before first query in thread void ThreadStart(); // must be call before finish thread run diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp index 7d53eba1ff3..19a62912299 100644 --- a/src/shared/Util.cpp +++ b/src/shared/Util.cpp @@ -112,7 +112,7 @@ Tokens StrSplit(const std::string &src, const std::string &sep) { Tokens r; std::string s; - for (std::string::const_iterator i = src.begin(); i != src.end(); i++) + for (std::string::const_iterator i = src.begin(); i != src.end(); ++i) { if (sep.find(*i) != std::string::npos) { @@ -205,7 +205,7 @@ uint32 TimeStringToSecs(const std::string& timestring) uint32 buffer = 0; uint32 multiplier = 0; - for(std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); itr++ ) + for(std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); ++itr) { if(isdigit(*itr)) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c17683a479e..f953f5b87c2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11927" + #define REVISION_NR "11928" #endif // __REVISION_NR_H__