Permalink
Browse files

[11928] Some warning fixes

  • Loading branch information...
1 parent 479a8b3 commit 499e1c831b9afd3f6bc02cb90d8a9a861e2b84a3 zergtmn committed Feb 16, 2012
View
@@ -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);
}
View
@@ -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;
View
@@ -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())
View
@@ -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 ***/
View
@@ -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)
View
@@ -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 );
View
@@ -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;
View
@@ -185,7 +185,7 @@ bool changeGuid(std::string &str, int n, std::map<uint32, uint32> &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<uint32, uint32> &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<uint32,uint32> items;
View
@@ -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;
View
@@ -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;
@@ -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)
@@ -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;)
{
@@ -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;
@@ -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);
@@ -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;
}
@@ -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
View
@@ -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))
{
View
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "11927"
+ #define REVISION_NR "11928"
#endif // __REVISION_NR_H__

0 comments on commit 499e1c8

Please sign in to comment.