Core: Fix some warnings

--HG--
branch : trunk
This commit is contained in:
Spp
2010-08-23 07:51:19 +02:00
parent ccc2a83510
commit 16d95d3115
30 changed files with 121 additions and 85 deletions
+2 -2
View File
@@ -75,7 +75,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
uint64 banned_guid = atol((*iter).c_str());
if (banned_guid)
{
sLog.outDebug("Channel(%s) loaded banned guid: %u",name.c_str(), banned_guid);
sLog.outDebug("Channel(%s) loaded banned guid:" UI64FMTD "",name.c_str(), banned_guid);
banned.insert(banned_guid);
}
}
@@ -552,7 +552,7 @@ void Channel::List(Player* player)
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) &&
if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
plr->IsVisibleGloballyFor(player))
{
data << uint64(i->first);
+5 -4
View File
@@ -805,7 +805,7 @@ const char *ChatHandler::GetTrinityString(int32 entry) const
bool ChatHandler::isAvailable(ChatCommand const& cmd) const
{
// check security level only for simple command (without child commands)
return m_session->GetSecurity() >= cmd.SecurityLevel;
return m_session->GetSecurity() >= AccountTypes(cmd.SecurityLevel);
}
bool ChatHandler::HasLowerSecurity(Player* target, uint64 guid, bool strong)
@@ -847,7 +847,8 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
else
return true; // caller must report error for (target == NULL && target_account == 0)
if (m_session->GetSecurity() < target_sec || (strong && m_session->GetSecurity() <= target_sec))
AccountTypes target_ac_sec = AccountTypes(target_sec);
if (m_session->GetSecurity() < target_ac_sec || (strong && m_session->GetSecurity() <= target_ac_sec))
{
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
SetSentErrorMessage(true);
@@ -1658,10 +1659,10 @@ valid examples:
ItemLocale const *il = sObjectMgr.GetItemLocale(linkedItem->ItemId);
bool foundName = false;
for (uint8 i=LOCALE_koKR; i<MAX_LOCALE; ++i)
for (uint8 i = LOCALE_koKR; i < MAX_LOCALE; ++i)
{
int8 dbIndex = sObjectMgr.GetIndexForLocale(LocaleConstant(i));
if (dbIndex == -1 || il == NULL || dbIndex >= il->Name.size())
if (dbIndex == -1 || il == NULL || uint8(dbIndex) >= il->Name.size())
// using strange database/client combinations can lead to this case
expectedName = linkedItem->Name1;
else
+3 -3
View File
@@ -147,7 +147,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
// save if the player has last been saved over 20 seconds ago
uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE);
if ((save_interval == 0 || save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
if (save_interval == 0 || (save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
player->SaveToDB();
return true;
@@ -162,7 +162,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/)
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
{
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) &&
if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= AccountTypes(sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) &&
(!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer())))
{
if (first)
@@ -252,7 +252,7 @@ bool ChatHandler::HandleAccountAddonCommand(const char* args)
uint32 account_id = m_session->GetAccountId();
int expansion = atoi(szExp); //get int anyway (0 if error)
if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
if (expansion < 0 || uint8(expansion) > sWorld.getConfig(CONFIG_EXPANSION))
{
SendSysMessage(LANG_IMPROPER_VALUE);
SetSentErrorMessage(true);
+5 -5
View File
@@ -2258,7 +2258,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
if (email.empty())
email = "-";
if (!m_session || m_session->GetSecurity() >= security)
if (!m_session || m_session->GetSecurity() >= AccountTypes(security))
{
last_ip = fields[3].GetCppString();
last_login = fields[4].GetCppString();
@@ -3073,7 +3073,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
return false;
}
sLog.outDebug("DEBUG: UPDATE waypoint_data SET wpguid = '%u");
sLog.outDebug("DEBUG: UPDATE waypoint_data SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), pathid, point);
// set "wpguid" column to the visual waypoint
WorldDatabase.PExecute("UPDATE waypoint_data SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), pathid, point);
@@ -3544,7 +3544,7 @@ bool ChatHandler::HandleEventStartCommand(const char* args)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
if (event_id < 1 || event_id >=events.size())
if (event_id < 1 || uint32(event_id) >= events.size())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@@ -3585,7 +3585,7 @@ bool ChatHandler::HandleEventStopCommand(const char* args)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
if (event_id < 1 || event_id >=events.size())
if (event_id < 1 || uint32(event_id) >= events.size())
{
SendSysMessage(LANG_EVENT_NOT_EXIST);
SetSentErrorMessage(true);
@@ -4236,7 +4236,7 @@ bool ChatHandler::HandleNpcSetLinkCommand(const char* args)
if (!pCreature->GetDBTableGUIDLow())
{
PSendSysMessage("Selected creature isn't in creature table", pCreature->GetGUIDLow());
PSendSysMessage("Selected creature %u isn't in creature table", pCreature->GetGUIDLow());
SetSentErrorMessage(true);
return false;
}
+21 -13
View File
@@ -1171,7 +1171,11 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char *args)
// m_session == NULL only for console
targetAccountId = (isAccountNameGiven) ? sAccountMgr.GetId(targetAccountName) : getSelectedPlayer()->GetSession()->GetAccountId();
int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2);
uint32 plSecurity = m_session ? sAccountMgr.GetSecurity(m_session->GetAccountId(), gmRealmID) : SEC_CONSOLE;
uint32 plSecurity;
if (m_session)
plSecurity = sAccountMgr.GetSecurity(m_session->GetAccountId(), gmRealmID);
else
plSecurity = SEC_CONSOLE;
// can set security level only for target with less security and to less security that we have
// This is also reject self apply in fact
@@ -2943,12 +2947,13 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
uint8 uloc_idx = uint8(loc_idx);
ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId);
if (il)
{
if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty())
if (il->Name.size() > uloc_idx && !il->Name[uloc_idx].empty())
{
std::string name = il->Name[loc_idx];
std::string name = il->Name[uloc_idx];
if (Utf8FitTo(name, wnamepart))
{
@@ -3257,12 +3262,13 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
uint8 uloc_idx = uint8(loc_idx);
QuestLocale const *il = sObjectMgr.GetQuestLocale(qinfo->GetQuestId());
if (il)
{
if (il->Title.size() > loc_idx && !il->Title[loc_idx].empty())
if (il->Title.size() > uloc_idx && !il->Title[uloc_idx].empty())
{
std::string title = il->Title[loc_idx];
std::string title = il->Title[uloc_idx];
if (Utf8FitTo(title, wnamepart))
{
@@ -3361,12 +3367,13 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
uint8 uloc_idx = uint8(uloc_idx);
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale (id);
if (cl)
{
if (cl->Name.size() > loc_idx && !cl->Name[loc_idx].empty ())
if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty ())
{
std::string name = cl->Name[loc_idx];
std::string name = cl->Name[uloc_idx];
if (Utf8FitTo (name, wnamepart))
{
@@ -3431,12 +3438,13 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
uint8 uloc_idx = uint8(uloc_idx);
GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(id);
if (gl)
{
if (gl->Name.size() > loc_idx && !gl->Name[loc_idx].empty())
if (gl->Name.size() > uloc_idx && !gl->Name[uloc_idx].empty())
{
std::string name = gl->Name[loc_idx];
std::string name = gl->Name[uloc_idx];
if (Utf8FitTo(name, wnamepart))
{
@@ -5149,7 +5157,7 @@ bool ChatHandler::HandleServerRestartCommand(const char *args)
int32 time = atoi (time_str);
///- Prevent interpret wrong arg value as 0 secs shutdown time
if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0') || time < 0))
if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0)
return false;
if (exitcode_str)
@@ -5184,7 +5192,7 @@ bool ChatHandler::HandleServerIdleRestartCommand(const char *args)
int32 time = atoi (time_str);
///- Prevent interpret wrong arg value as 0 secs shutdown time
if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0') || time < 0))
if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0)
return false;
if (exitcode_str)
@@ -5219,7 +5227,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char *args)
int32 time = atoi (time_str);
///- Prevent interpret wrong arg value as 0 secs shutdown time
if (time == 0 && (time_str[0] != '0' || time_str[1] != '\0') || time < 0)
if ((time == 0 && (time_str[0] != '0' || time_str[1] != '\0')) || time < 0)
return false;
if (exitcode_str)
@@ -6719,7 +6727,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char *args)
return false;
int expansion = atoi(szExp); //get int anyway (0 if error)
if (expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
if (expansion < 0 || uint8(expansion) > sWorld.getConfig(CONFIG_EXPANSION))
return false;
// No SQL injection