[11928] Some warning fixes

This commit is contained in:
zergtmn 2012-02-16 20:31:48 +06:00
parent 7c827733f5
commit c6a751134c
18 changed files with 28 additions and 38 deletions

View file

@ -338,7 +338,7 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err
if(f) if(f)
{ {
char buf[100]; 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); errlist.push_back(dbc_filename + buf);
fclose(f); fclose(f);
} }

View file

@ -1510,11 +1510,8 @@ void GameObject::Use(Unit* user)
switch(info->id) switch(info->id)
{ {
case 179785: // Silverwing Flag case 179785: // Silverwing Flag
// check if it's correct bg
if (bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 179786: // Warsong Flag case 179786: // Warsong Flag
// check if it's correct bg
if (bg->GetTypeID() == BATTLEGROUND_WS) if (bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this); bg->EventPlayerClickedOnFlag(player, this);
break; break;

View file

@ -1677,7 +1677,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
return false; return false;
} }
bool Group::SetPlayerMap(const ObjectGuid guid, uint32 mapid) bool Group::SetPlayerMap(ObjectGuid guid, uint32 mapid)
{ {
member_witerator slot = _getMemberWSlot(guid); member_witerator slot = _getMemberWSlot(guid);
if (slot != m_memberSlots.end()) if (slot != m_memberSlots.end())

View file

@ -339,7 +339,7 @@ class MANGOS_DLL_SPEC Group
void RewardGroupAtKill(Unit* pVictim, Player* player_tap); void RewardGroupAtKill(Unit* pVictim, Player* player_tap);
bool SetPlayerMap(const ObjectGuid guid, uint32 mapid); bool SetPlayerMap(ObjectGuid guid, uint32 mapid);
/*********************************************************/ /*********************************************************/
/*** LOOT SYSTEM ***/ /*** LOOT SYSTEM ***/

View file

@ -678,17 +678,12 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
*data << uint32(mask); *data << uint32(mask);
if (mask & GROUP_UPDATE_FLAG_STATUS) if (mask & GROUP_UPDATE_FLAG_STATUS)
{
if (player)
{ {
if (player->IsPvP()) if (player->IsPvP())
*data << uint16(MEMBER_STATUS_ONLINE | MEMBER_STATUS_PVP); *data << uint16(MEMBER_STATUS_ONLINE | MEMBER_STATUS_PVP);
else else
*data << uint16(MEMBER_STATUS_ONLINE); *data << uint16(MEMBER_STATUS_ONLINE);
} }
else
*data << uint16(MEMBER_STATUS_OFFLINE);
}
if (mask & GROUP_UPDATE_FLAG_CUR_HP) if (mask & GROUP_UPDATE_FLAG_CUR_HP)
*data << uint32(player->GetHealth()); *data << uint32(player->GetHealth());

View file

@ -8031,7 +8031,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
// explicit name case // explicit name case
std::wstring wname; std::wstring wname;
if(!Utf8toWStr(name,wname)) if(!Utf8toWStr(name,wname))
return false; return NULL;
// converting string that we try to find to lower case // converting string that we try to find to lower case
wstrToLower( wname ); wstrToLower( wname );

View file

@ -951,7 +951,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
int32 createResistance[MAX_SPELL_SCHOOL] = {0,0,0,0,0,0,0}; 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_HOLY] = cinfo->resistance1;
createResistance[SPELL_SCHOOL_FIRE] = cinfo->resistance2; createResistance[SPELL_SCHOOL_FIRE] = cinfo->resistance2;

View file

@ -185,7 +185,7 @@ bool changeGuid(std::string &str, int n, std::map<uint32, uint32> &guidMap, uint
return true; // not an error return true; // not an error
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid); uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
snprintf(chritem, 20, "%d", newGuid); snprintf(chritem, 20, "%u", newGuid);
return changenth(str, n, chritem, false, nonzero); 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 return true; // not an error
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid); uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
snprintf(chritem, 20, "%d", newGuid); snprintf(chritem, 20, "%u", newGuid);
return changetoknth(str, n, chritem, false, nonzero); 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 // name encoded or empty
snprintf(newguid, 20, "%d", guid); snprintf(newguid, 20, "%u", guid);
snprintf(chraccount, 20, "%d", account); snprintf(chraccount, 20, "%u", account);
snprintf(newpetid, 20, "%d", sObjectMgr.GeneratePetNumber()); snprintf(newpetid, 20, "%u", sObjectMgr.GeneratePetNumber());
snprintf(lastpetid, 20, "%s", ""); snprintf(lastpetid, 20, "%s", "");
std::map<uint32,uint32> items; std::map<uint32,uint32> items;

View file

@ -4807,10 +4807,7 @@ SpellCastResult Spell::CheckCast(bool strict)
else else
return SPELL_FAILED_BAD_TARGETS; return SPELL_FAILED_BAD_TARGETS;
} }
}
if(non_caster_target)
{
// simple cases // simple cases
bool explicit_target_mode = false; bool explicit_target_mode = false;
bool target_hostile = false; bool target_hostile = false;

View file

@ -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 // flag for seelction is need apply aura to current iteration target
bool apply = true; bool apply = true;

View file

@ -4247,7 +4247,6 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype)
pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetObjectGuid()); pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetObjectGuid());
// send info to the client // 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 // we succeeded in creating at least one item, so a levelup is possible

View file

@ -295,7 +295,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
bool checkedCurrentVictim = false; bool checkedCurrentVictim = false;
ThreatList::const_iterator lastRef = iThreatList.end(); ThreatList::const_iterator lastRef = iThreatList.end();
lastRef--; --lastRef;
for (ThreatList::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) for (ThreatList::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
{ {

View file

@ -2457,6 +2457,9 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
// Improved Water Shield // Improved Water Shield
if (dummySpell->SpellIconID == 2287) if (dummySpell->SpellIconID == 2287)
{ {
if (!procSpell)
return SPELL_AURA_PROC_FAILED;
// Lesser Healing Wave need aditional 60% roll // Lesser Healing Wave need aditional 60% roll
if ((procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080)) && !roll_chance_i(60)) if ((procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080)) && !roll_chance_i(60))
return SPELL_AURA_PROC_FAILED; return SPELL_AURA_PROC_FAILED;

View file

@ -307,7 +307,7 @@ QueryResult* Database::PQuery(const char *format,...)
if(res==-1) if(res==-1)
{ {
sLog.outError("SQL Query truncated (and not execute) for format: %s",format); sLog.outError("SQL Query truncated (and not execute) for format: %s",format);
return false; return NULL;
} }
return Query(szQuery); return Query(szQuery);
@ -326,7 +326,7 @@ QueryNamedResult* Database::PQueryNamed(const char *format,...)
if(res==-1) if(res==-1)
{ {
sLog.outError("SQL Query truncated (and not execute) for format: %s",format); sLog.outError("SQL Query truncated (and not execute) for format: %s",format);
return false; return NULL;
} }
return QueryNamed(szQuery); return QueryNamed(szQuery);

View file

@ -337,7 +337,7 @@ bool MySqlPreparedStatement::prepare()
m_stmt = mysql_stmt_init(m_pMySQLConn); m_stmt = mysql_stmt_init(m_pMySQLConn);
if (!m_stmt) if (!m_stmt)
{ {
sLog.outError("SQL: mysql_stmt_init()() failed "); sLog.outError("SQL: mysql_stmt_init() failed ");
return false; return false;
} }

View file

@ -72,6 +72,8 @@ class MANGOS_DLL_SPEC MySQLConnection : public SqlConnection
MySQLConnection(Database& db) : SqlConnection(db), mMysql(NULL) {} MySQLConnection(Database& db) : SqlConnection(db), mMysql(NULL) {}
~MySQLConnection(); ~MySQLConnection();
//! Initializes Mysql and connects to a server.
/*! infoString should be formated like hostname;username;password;database. */
bool Initialize(const char *infoString); bool Initialize(const char *infoString);
QueryResult* Query(const char *sql); QueryResult* Query(const char *sql);
@ -102,9 +104,6 @@ class MANGOS_DLL_SPEC DatabaseMysql : public Database
DatabaseMysql(); DatabaseMysql();
~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 // must be call before first query in thread
void ThreadStart(); void ThreadStart();
// must be call before finish thread run // must be call before finish thread run

View file

@ -112,7 +112,7 @@ Tokens StrSplit(const std::string &src, const std::string &sep)
{ {
Tokens r; Tokens r;
std::string s; 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) if (sep.find(*i) != std::string::npos)
{ {
@ -205,7 +205,7 @@ uint32 TimeStringToSecs(const std::string& timestring)
uint32 buffer = 0; uint32 buffer = 0;
uint32 multiplier = 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)) if(isdigit(*itr))
{ {

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11927" #define REVISION_NR "11928"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__