Skip to content

Commit

Permalink
[11928] Some warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zergtmn committed Feb 16, 2012
1 parent 479a8b3 commit 499e1c8
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/game/DBCStores.cpp
Expand Up @@ -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);
}
Expand Down
5 changes: 1 addition & 4 deletions src/game/GameObject.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/game/Group.cpp
Expand Up @@ -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)
{

This comment has been minimized.

Copy link
@Reamer

Reamer Feb 17, 2012

Contributor

Why you remove const?
const is good for compiler

This comment has been minimized.

Copy link
@VladimirMangos

VladimirMangos Feb 17, 2012

in case send by value (instead by reference) no differences for compiler.

const useful in case: const T& tt, or const T* from other side as you point.

This comment has been minimized.

Copy link
@vermie

vermie Feb 17, 2012

Contributor

const also helps the compiler generate code that makes more efficient use of registers
tiny function though, probably doesn't make a difference in this case

member_witerator slot = _getMemberWSlot(guid);
if (slot != m_memberSlots.end())
Expand Down
2 changes: 1 addition & 1 deletion src/game/Group.h
Expand Up @@ -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 ***/
Expand Down
11 changes: 3 additions & 8 deletions src/game/GroupHandler.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/game/ObjectMgr.cpp
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/game/Pet.cpp
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions src/game/PlayerDump.cpp
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions src/game/Spell.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/game/SpellAuras.cpp
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/game/SpellEffects.cpp
Expand Up @@ -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);

This comment has been minimized.

Copy link
@Reamer

Reamer Feb 17, 2012

Contributor

Why you remove the pItem check?

This comment has been minimized.

Copy link
@cenfa

cenfa Feb 17, 2012

It is already checked.

This comment has been minimized.

Copy link
@Reamer

Reamer Feb 17, 2012

Contributor

thx for answer, i hate small diffs xD

This comment has been minimized.

Copy link
@VladimirMangos

VladimirMangos Feb 17, 2012

eartly by code already expected that pItem != NULL

// we succeeded in creating at least one item, so a levelup is possible
if(!bg_mark)
Expand Down
2 changes: 1 addition & 1 deletion src/game/ThreatManager.cpp
Expand Up @@ -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;)
{
Expand Down
3 changes: 3 additions & 0 deletions src/game/UnitAuraProcHandler.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/shared/Database/Database.cpp
Expand Up @@ -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;

This comment has been minimized.

Copy link
@Reamer

Reamer Feb 17, 2012

Contributor

return values is boolean Why NULL?

This comment has been minimized.

Copy link
@VladimirMangos

VladimirMangos Feb 17, 2012

git parser lost context: in fact chagnes in QueryResult* Database::PQuery(const char *format,...)

This comment has been minimized.

Copy link
@Reamer

Reamer Feb 17, 2012

Contributor

thx

}

return Query(szQuery);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/Database/DatabaseMysql.cpp
Expand Up @@ -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;
}

Expand Down
5 changes: 2 additions & 3 deletions src/shared/Database/DatabaseMysql.h
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/shared/Util.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion 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__

0 comments on commit 499e1c8

Please sign in to comment.