Core/Misc: Multiple static analysis issues fixed (small optimizations and clear code)
This commit is contained in:
1 parent
e6b7de8c97
commit
cefcde9ba9
40 files changed
+72
-84
No files matched your search
@@ -236,7 +236,7 @@ namespace VMAP
|
||||
MapData::iterator map_iter = mapData.find(mapID);
|
||||
if (map_iter == mapData.end())
|
||||
{
|
||||
printf("spawning Map %d\n", mapID);
|
||||
printf("spawning Map %u\n", mapID);
|
||||
mapData[mapID] = current = new MapSpawns();
|
||||
}
|
||||
else current = (*map_iter).second;
|
||||
|
||||
@@ -133,7 +133,6 @@ Battleground::Battleground()
|
||||
m_IsRated = false;
|
||||
m_BuffChange = false;
|
||||
m_IsRandom = false;
|
||||
m_Name = "";
|
||||
m_LevelMin = 0;
|
||||
m_LevelMax = 0;
|
||||
m_InBGFreeSlotQueue = false;
|
||||
|
||||
@@ -865,7 +865,7 @@ bool BattlegroundIC::IsSpellAllowed(uint32 spellId, Player const* player) const
|
||||
case SPELL_QUARRY:
|
||||
{
|
||||
uint32 team = player->GetTeamId();
|
||||
uint8 nodeType = spellId = SPELL_OIL_REFINERY ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
|
||||
uint8 nodeType = spellId == SPELL_OIL_REFINERY ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
|
||||
uint8 nodeState = team == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
|
||||
return GetNodeState(nodeType) == nodeState;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void LfgPlayerData::SetState(LfgState state)
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
m_Roles = 0;
|
||||
m_SelectedDungeons.clear();
|
||||
m_Comment = "";
|
||||
m_Comment.clear();
|
||||
// No break on purpose
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
|
||||
@@ -75,8 +75,7 @@ GameObject::~GameObject()
|
||||
|
||||
bool GameObject::AIM_Initialize()
|
||||
{
|
||||
if (m_AI)
|
||||
delete m_AI;
|
||||
delete m_AI;
|
||||
|
||||
m_AI = FactorySelector::SelectGameObjectAI(this);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class Pet : public Guardian
|
||||
bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner);
|
||||
bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask);
|
||||
bool LoadPetFromDB(Player* owner, uint32 petentry = 0, uint32 petnumber = 0, bool current = false);
|
||||
bool isBeingLoaded() const override { return m_loading;}
|
||||
bool IsLoading() const override { return m_loading;}
|
||||
void SavePetToDB(PetSaveMode mode);
|
||||
void Remove(PetSaveMode mode, bool returnreagent = false);
|
||||
static void DeleteFromDB(uint32 guidlow);
|
||||
|
||||
@@ -14813,7 +14813,7 @@ void Player::SendPreparedQuest(ObjectGuid guid)
|
||||
{
|
||||
qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote
|
||||
qe._Emote = 0; //TEXTEMOTE_HELLO; //zyg: NPC emote
|
||||
title = "";
|
||||
title.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -17131,7 +17131,7 @@ float Player::GetFloatValueFromArray(Tokenizer const& data, uint16 index)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Player::isBeingLoaded() const
|
||||
bool Player::IsLoading() const
|
||||
{
|
||||
return GetSession()->PlayerLoading();
|
||||
}
|
||||
@@ -26851,11 +26851,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
|
||||
return pet;
|
||||
}
|
||||
|
||||
bool Player::IsLoading() const
|
||||
{
|
||||
return GetSession()->PlayerLoading();
|
||||
}
|
||||
|
||||
void Player::SendSupercededSpell(uint32 oldSpell, uint32 newSpell)
|
||||
{
|
||||
WorldPacket data(SMSG_SUPERCEDED_SPELL, 8);
|
||||
|
||||
@@ -1487,7 +1487,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
/*********************************************************/
|
||||
|
||||
bool LoadFromDB(ObjectGuid guid, SQLQueryHolder *holder);
|
||||
bool isBeingLoaded() const override;
|
||||
bool IsLoading() const override;
|
||||
|
||||
void Initialize(uint32 guid);
|
||||
static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index);
|
||||
|
||||
@@ -3286,7 +3286,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
|
||||
if (aura->IsSingleTarget())
|
||||
{
|
||||
ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()) ||
|
||||
(isBeingLoaded() && aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE)));
|
||||
(IsLoading() && aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE)));
|
||||
/* @HACK: Player is not in world during loading auras.
|
||||
* Single target auras are not saved or loaded from database
|
||||
* but may be created as a result of aura links (player mounts with passengers)
|
||||
|
||||
@@ -2135,7 +2135,7 @@ class Unit : public WorldObject
|
||||
virtual float GetFollowAngle() const { return static_cast<float>(M_PI/2); }
|
||||
|
||||
void OutDebugInfo() const;
|
||||
virtual bool isBeingLoaded() const { return false;}
|
||||
virtual bool IsLoading() const { return false; }
|
||||
bool IsDuringRemoveFromWorld() const {return m_duringRemoveFromWorld;}
|
||||
|
||||
Pet* ToPet() { if (IsPet()) return reinterpret_cast<Pet*>(this); else return NULL; }
|
||||
|
||||
@@ -448,11 +448,11 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
// over AuraEffectList caused "incompatible iterator" errors on second pass
|
||||
std::list<uint32> spellIDs;
|
||||
|
||||
for (Unit::AuraEffectList::const_iterator auraEffect = auraEffects.begin(); auraEffect != auraEffects.end(); auraEffect++)
|
||||
for (Unit::AuraEffectList::const_iterator auraEffect = auraEffects.begin(); auraEffect != auraEffects.end(); ++auraEffect)
|
||||
spellIDs.push_back((*auraEffect)->GetId());
|
||||
|
||||
// Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a)
|
||||
for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); it++)
|
||||
for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); ++it)
|
||||
_player->RemoveOwnedAura(*it, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ uint32 LootStore::LoadLootTable()
|
||||
if (group >= 1 << 7) // it stored in 7 bit field
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", GetName(), entry, item, group, 1 << 7);
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LootStoreItem* storeitem = new LootStoreItem(item, chanceOrQuestChance, lootmode, group, mincountOrRef, maxcount);
|
||||
|
||||
@@ -3059,7 +3059,7 @@ void InstanceMap::CreateInstanceData(bool load)
|
||||
Field* fields = result->Fetch();
|
||||
std::string data = fields[0].GetString();
|
||||
i_data->SetCompletedEncountersMask(fields[1].GetUInt32());
|
||||
if (data != "")
|
||||
if (!data.empty())
|
||||
{
|
||||
TC_LOG_DEBUG("maps", "Loading instance data for `%s` with id %u", sObjectMgr->GetScriptName(i_script_id), i_InstanceId);
|
||||
i_data->Load(data.c_str());
|
||||
|
||||
@@ -98,7 +98,7 @@ void PacketLog::Initialize()
|
||||
}
|
||||
}
|
||||
|
||||
void PacketLog::LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address addr, uint16 port)
|
||||
void PacketLog::LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address const& addr, uint16 port)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_logPacketLock);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class PacketLog
|
||||
|
||||
void Initialize();
|
||||
bool CanLogPacket() const { return (_file != NULL); }
|
||||
void LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address addr, uint16 port);
|
||||
void LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address const& addr, uint16 port);
|
||||
|
||||
private:
|
||||
FILE* _file;
|
||||
|
||||
@@ -232,7 +232,7 @@ void WorldSocket::SendPacket(WorldPacket& packet)
|
||||
|
||||
void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
{
|
||||
uint8 digest[20];
|
||||
uint8 digest[SHA_DIGEST_LENGTH];
|
||||
uint32 clientSeed;
|
||||
uint8 security;
|
||||
uint32 id;
|
||||
@@ -349,7 +349,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
sha.UpdateBigNumbers(&k, NULL);
|
||||
sha.Finalize();
|
||||
|
||||
if (memcmp(sha.GetDigest(), digest, 20))
|
||||
if (memcmp(sha.GetDigest(), digest, SHA_DIGEST_LENGTH) != 0)
|
||||
{
|
||||
SendAuthResponseError(AUTH_FAILED);
|
||||
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
|
||||
@@ -360,7 +360,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||
///- Re-check ip locking (same check as in auth).
|
||||
if (fields[3].GetUInt8() == 1) // if ip is locked
|
||||
{
|
||||
if (strcmp(fields[2].GetCString(), address.c_str()))
|
||||
if (strcmp(fields[2].GetCString(), address.c_str()) != 0)
|
||||
{
|
||||
SendAuthResponseError(AUTH_FAILED);
|
||||
TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str());
|
||||
|
||||
@@ -7267,8 +7267,7 @@ WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* ref
|
||||
|
||||
WorldObjectSpellTargetCheck::~WorldObjectSpellTargetCheck()
|
||||
{
|
||||
if (_condSrcInfo)
|
||||
delete _condSrcInfo;
|
||||
delete _condSrcInfo;
|
||||
}
|
||||
|
||||
bool WorldObjectSpellTargetCheck::operator()(WorldObject* target)
|
||||
|
||||
@@ -973,10 +973,10 @@ bool SpellMgr::CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcE
|
||||
// check spell family name/flags (if set) for spells
|
||||
if (eventInfo.GetTypeMask() & (PERIODIC_PROC_FLAG_MASK | SPELL_PROC_FLAG_MASK | PROC_FLAG_DONE_TRAP_ACTIVATION))
|
||||
{
|
||||
if (procEntry.spellFamilyName && (procEntry.spellFamilyName != eventInfo.GetSpellInfo()->SpellFamilyName))
|
||||
if (procEntry.spellFamilyName && eventInfo.GetSpellInfo() && (procEntry.spellFamilyName != eventInfo.GetSpellInfo()->SpellFamilyName))
|
||||
return false;
|
||||
|
||||
if (procEntry.spellFamilyMask && !(procEntry.spellFamilyMask & eventInfo.GetSpellInfo()->SpellFamilyFlags))
|
||||
if (procEntry.spellFamilyMask && eventInfo.GetSpellInfo() && !(procEntry.spellFamilyMask & eventInfo.GetSpellInfo()->SpellFamilyFlags))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -342,9 +342,7 @@ bool PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
|
||||
|
||||
bool PlayerDumpWriter::GetDump(uint32 guid, std::string &dump)
|
||||
{
|
||||
dump = "";
|
||||
|
||||
dump += "IMPORTANT NOTE: THIS DUMPFILE IS MADE FOR USE WITH THE 'PDUMP' COMMAND ONLY - EITHER THROUGH INGAME CHAT OR ON CONSOLE!\n";
|
||||
dump = "IMPORTANT NOTE: THIS DUMPFILE IS MADE FOR USE WITH THE 'PDUMP' COMMAND ONLY - EITHER THROUGH INGAME CHAT OR ON CONSOLE!\n";
|
||||
dump += "IMPORTANT NOTE: DO NOT apply it directly - it will irreversibly DAMAGE and CORRUPT your database! You have been warned!\n\n";
|
||||
|
||||
for (int i = 0; i < DUMP_TABLE_COUNT; ++i)
|
||||
@@ -425,7 +423,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
|
||||
|
||||
// normalize the name if specified and check if it exists
|
||||
if (!normalizePlayerName(name))
|
||||
name = "";
|
||||
name.clear();
|
||||
|
||||
if (ObjectMgr::CheckPlayerName(name, true) == CHAR_NAME_SUCCESS)
|
||||
{
|
||||
@@ -434,10 +432,10 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
name = ""; // use the one from the dump
|
||||
name.clear(); // use the one from the dump
|
||||
}
|
||||
else
|
||||
name = "";
|
||||
name.clear();
|
||||
|
||||
// name encoded or empty
|
||||
|
||||
@@ -533,7 +531,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
|
||||
playerClass = uint8(atol(getnth(line, 5).c_str()));
|
||||
gender = uint8(atol(getnth(line, 6).c_str()));
|
||||
level = uint8(atol(getnth(line, 7).c_str()));
|
||||
if (name == "")
|
||||
if (name.empty())
|
||||
{
|
||||
// check if the original name already exists
|
||||
name = getnth(line, 3);
|
||||
@@ -629,7 +627,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
|
||||
snprintf(lastpetid, 20, "%s", currpetid);
|
||||
if (strcmp(lastpetid, currpetid) != 0)
|
||||
{
|
||||
snprintf(newpetid, 20, "%d", sObjectMgr->GeneratePetNumber());
|
||||
snprintf(newpetid, 20, "%u", sObjectMgr->GeneratePetNumber());
|
||||
snprintf(lastpetid, 20, "%s", currpetid);
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
|
||||
uint8 sha1Hash[20];
|
||||
buff.read(sha1Hash, 20);
|
||||
|
||||
if (memcmp(sha1Hash, sha1.GetDigest(), 20))
|
||||
if (memcmp(sha1Hash, sha1.GetDigest(), 20) != 0)
|
||||
{
|
||||
TC_LOG_DEBUG("warden", "Handle data failed: SHA1 hash is wrong!");
|
||||
//found = true;
|
||||
@@ -259,7 +259,7 @@ void WardenMac::HandleData(ByteBuffer &buff)
|
||||
uint8 theirsMD5Hash[16];
|
||||
buff.read(theirsMD5Hash, 16);
|
||||
|
||||
if (memcmp(ourMD5Hash, theirsMD5Hash, 16))
|
||||
if (memcmp(ourMD5Hash, theirsMD5Hash, 16) != 0)
|
||||
{
|
||||
TC_LOG_DEBUG("warden", "Handle data failed: MD5 hash is wrong!");
|
||||
//found = true;
|
||||
|
||||
@@ -775,7 +775,7 @@ public:
|
||||
if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
|
||||
return false;
|
||||
|
||||
if (strcmp(password, passwordConfirmation))
|
||||
if (strcmp(password, passwordConfirmation) != 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
|
||||
handler->SetSentErrorMessage(true);
|
||||
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
std::string type;
|
||||
parsedStream >> type;
|
||||
|
||||
if (type == "")
|
||||
if (type.empty())
|
||||
break;
|
||||
|
||||
if (type == "uint8")
|
||||
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
{
|
||||
Guild* guild = nullptr;
|
||||
|
||||
if (args && strlen(args) > 0)
|
||||
if (args && args[0] != '\0')
|
||||
{
|
||||
if (isNumeric(args))
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
uint16 counter = 0;
|
||||
uint16 MapId = 0;
|
||||
|
||||
if (strcmp(map, "all"))
|
||||
if (strcmp(map, "all") != 0)
|
||||
{
|
||||
MapId = uint16(atoi(map));
|
||||
if (!MapId)
|
||||
|
||||
@@ -199,10 +199,12 @@ public:
|
||||
else
|
||||
handler->PSendSysMessage(LANG_GPS_NO_VMAP);
|
||||
|
||||
char const* unknown = handler->GetTrinityString(LANG_UNKNOWN);
|
||||
|
||||
handler->PSendSysMessage(LANG_MAP_POSITION,
|
||||
mapId, (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)),
|
||||
zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)),
|
||||
areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : handler->GetTrinityString(LANG_UNKNOWN)),
|
||||
mapId, (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : unknown),
|
||||
zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : unknown),
|
||||
areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : unknown),
|
||||
object->GetPhaseMask(),
|
||||
object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
|
||||
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
|
||||
@@ -1711,7 +1713,9 @@ public:
|
||||
}
|
||||
|
||||
if (target)
|
||||
handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)), (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
|
||||
handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale],
|
||||
(!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)),
|
||||
(!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)));
|
||||
|
||||
// Output XVII. - XVIX. if they are not empty
|
||||
if (!guildName.empty())
|
||||
@@ -2187,7 +2191,7 @@ public:
|
||||
{
|
||||
Player* target = NULL;
|
||||
|
||||
if (args && strlen(args) > 0)
|
||||
if (args && args[0] != '\0')
|
||||
{
|
||||
target = sObjectAccessor->FindPlayerByName(args);
|
||||
if (!target)
|
||||
|
||||
@@ -681,7 +681,7 @@ public:
|
||||
}
|
||||
|
||||
creature->AI()->SetData(data_1, data_2);
|
||||
std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
|
||||
std::string AIorScript = !creature->GetAIName().empty() ? "AI type: " + creature->GetAIName() : (!creature->GetScriptName().empty() ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
|
||||
handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID().GetCounter(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, NULL);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
player->StoreNewItem(dest, 11522, 1, true);
|
||||
player->StoreNewItem(dest, 11522, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -196,7 +196,7 @@ class boss_anubarak_trial : public CreatureScript
|
||||
std::list<Creature*> FrostSphereList;
|
||||
me->GetCreatureListWithEntryInGrid(FrostSphereList, NPC_FROST_SPHERE, 150.0f);
|
||||
if (!FrostSphereList.empty())
|
||||
for (std::list<Creature*>::iterator itr = FrostSphereList.begin(); itr != FrostSphereList.end(); itr++)
|
||||
for (std::list<Creature*>::iterator itr = FrostSphereList.begin(); itr != FrostSphereList.end(); ++itr)
|
||||
(*itr)->DespawnOrUnsummon();
|
||||
|
||||
_burrowGUID.clear();
|
||||
@@ -243,7 +243,7 @@ class boss_anubarak_trial : public CreatureScript
|
||||
me->GetCreatureListWithEntryInGrid(AddList, NPC_FROST_SPHERE, 150.0f);
|
||||
me->GetCreatureListWithEntryInGrid(AddList, NPC_BURROWER, 150.0f);
|
||||
if (!AddList.empty())
|
||||
for (std::list<Creature*>::iterator itr = AddList.begin(); itr != AddList.end(); itr++)
|
||||
for (std::list<Creature*>::iterator itr = AddList.begin(); itr != AddList.end(); ++itr)
|
||||
(*itr)->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ class instance_ulduar : public InstanceMapScript
|
||||
_algalonSummoned = false;
|
||||
_summonAlgalon = false;
|
||||
|
||||
memset(_summonObservationRingKeeper, false, sizeof(_summonObservationRingKeeper));
|
||||
memset(_summonYSKeeper, false, sizeof(_summonYSKeeper));
|
||||
memset(_summonObservationRingKeeper, 0, sizeof(_summonObservationRingKeeper));
|
||||
memset(_summonYSKeeper, 0, sizeof(_summonYSKeeper));
|
||||
}
|
||||
|
||||
void FillInitialWorldStates(WorldPacket& packet) override
|
||||
|
||||
@@ -459,7 +459,7 @@ public:
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30658, 1, NULL);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
player->StoreNewItem(dest, 30658, 1, true);
|
||||
player->StoreNewItem(dest, 30658, true);
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
}
|
||||
}
|
||||
@@ -469,7 +469,7 @@ public:
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30659, 1, NULL);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
player->StoreNewItem(dest, 30659, 1, true);
|
||||
player->StoreNewItem(dest, 30659, true);
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,11 +112,9 @@ bool DBCFileLoader::Load(const char* filename, const char* fmt)
|
||||
|
||||
DBCFileLoader::~DBCFileLoader()
|
||||
{
|
||||
if (data)
|
||||
delete [] data;
|
||||
delete[] data;
|
||||
|
||||
if (fieldsOffset)
|
||||
delete [] fieldsOffset;
|
||||
delete[] fieldsOffset;
|
||||
}
|
||||
|
||||
DBCFileLoader::Record DBCFileLoader::getRecord(size_t id)
|
||||
|
||||
@@ -76,13 +76,12 @@ class DatabaseWorkerPool
|
||||
|
||||
bool Open(const std::string& infoString, uint8 async_threads, uint8 synch_threads)
|
||||
{
|
||||
bool res = true;
|
||||
_connectionInfo = new MySQLConnectionInfo(infoString);
|
||||
|
||||
TC_LOG_INFO("sql.driver", "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
|
||||
GetDatabaseName(), async_threads, synch_threads);
|
||||
|
||||
res = OpenConnections(IDX_ASYNC, async_threads);
|
||||
bool res = OpenConnections(IDX_ASYNC, async_threads);
|
||||
|
||||
if (!res)
|
||||
return res;
|
||||
|
||||
@@ -57,8 +57,7 @@ m_connectionFlags(CONNECTION_ASYNC)
|
||||
|
||||
MySQLConnection::~MySQLConnection()
|
||||
{
|
||||
if (m_worker)
|
||||
delete m_worker;
|
||||
delete m_worker;
|
||||
|
||||
for (size_t i = 0; i < m_stmts.size(); ++i)
|
||||
delete m_stmts[i];
|
||||
|
||||
@@ -1043,7 +1043,7 @@ bool logChildren)
|
||||
offset, bHandled, Name, "", false, false);
|
||||
|
||||
// Set Value back to an empty string since the Array object itself has no value, only its elements have
|
||||
symbolDetails.top().Value = "";
|
||||
symbolDetails.top().Valu.clear();
|
||||
|
||||
DWORD elementsCount;
|
||||
if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_COUNT, &elementsCount))
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0
|
||||
#endif
|
||||
|
||||
void SetProcessPriority(const std::string logChannel)
|
||||
void SetProcessPriority(const std::string& logChannel)
|
||||
{
|
||||
// Suppresses Mac OS X Warning since logChannel isn't used.
|
||||
#if PLATFORM_APPLE
|
||||
|
||||
@@ -204,7 +204,8 @@ void WINAPI ServiceMain(DWORD argc, char *argv[])
|
||||
|
||||
GetModuleFileName(0, path, sizeof(path)/sizeof(path[0]));
|
||||
|
||||
for (i = 0; i < std::strlen(path); i++)
|
||||
size_t pathLen = std::strlen(path);
|
||||
for (i = 0; i < pathLen; i++)
|
||||
{
|
||||
if (path[i] == '\\') last_slash = i;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ size_t utf8length(std::string& utf8str)
|
||||
}
|
||||
catch(std::exception)
|
||||
{
|
||||
utf8str = "";
|
||||
utf8str.clear();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -316,7 +316,7 @@ void utf8truncate(std::string& utf8str, size_t len)
|
||||
}
|
||||
catch(std::exception)
|
||||
{
|
||||
utf8str = "";
|
||||
utf8str.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr)
|
||||
}
|
||||
catch(std::exception)
|
||||
{
|
||||
wstr = L"";
|
||||
wstr.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -383,14 +383,14 @@ bool WStrToUtf8(wchar_t* wstr, size_t size, std::string& utf8str)
|
||||
}
|
||||
catch(std::exception)
|
||||
{
|
||||
utf8str = "";
|
||||
utf8str.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WStrToUtf8(std::wstring wstr, std::string& utf8str)
|
||||
bool WStrToUtf8(std::wstring const& wstr, std::string& utf8str)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -406,7 +406,7 @@ bool WStrToUtf8(std::wstring wstr, std::string& utf8str)
|
||||
}
|
||||
catch(std::exception)
|
||||
{
|
||||
utf8str = "";
|
||||
utf8str.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ bool WStrToUtf8(std::wstring wstr, std::string& utf8str)
|
||||
|
||||
typedef wchar_t const* const* wstrlist;
|
||||
|
||||
std::wstring GetMainPartOfName(std::wstring wname, uint32 declension)
|
||||
std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension)
|
||||
{
|
||||
// supported only Cyrillic cases
|
||||
if (wname.size() < 1 || !isCyrillicCharacter(wname[0]) || declension > 5)
|
||||
@@ -492,7 +492,7 @@ bool consoleToUtf8(const std::string& conStr, std::string& utf8str)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Utf8FitTo(const std::string& str, std::wstring search)
|
||||
bool Utf8FitTo(const std::string& str, std::wstring const& search)
|
||||
{
|
||||
std::wstring temp;
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ inline bool Utf8toWStr(const std::string& utf8str, wchar_t* wstr, size_t& wsize)
|
||||
return Utf8toWStr(utf8str.c_str(), utf8str.size(), wstr, wsize);
|
||||
}
|
||||
|
||||
bool WStrToUtf8(std::wstring wstr, std::string& utf8str);
|
||||
bool WStrToUtf8(std::wstring const& wstr, std::string& utf8str);
|
||||
// size==real string size
|
||||
bool WStrToUtf8(wchar_t* wstr, size_t size, std::string& utf8str);
|
||||
|
||||
@@ -331,11 +331,11 @@ inline void wstrToLower(std::wstring& str)
|
||||
std::transform( str.begin(), str.end(), str.begin(), wcharToLower );
|
||||
}
|
||||
|
||||
std::wstring GetMainPartOfName(std::wstring wname, uint32 declension);
|
||||
std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension);
|
||||
|
||||
bool utf8ToConsole(const std::string& utf8str, std::string& conStr);
|
||||
bool consoleToUtf8(const std::string& conStr, std::string& utf8str);
|
||||
bool Utf8FitTo(const std::string& str, std::wstring search);
|
||||
bool Utf8FitTo(const std::string& str, std::wstring const& search);
|
||||
void utf8printf(FILE* out, const char *str, ...);
|
||||
void vutf8printf(FILE* out, const char *str, va_list* ap);
|
||||
|
||||
|
||||
@@ -268,8 +268,7 @@ extern int main(int argc, char** argv)
|
||||
delete soapThread;
|
||||
}
|
||||
|
||||
if (raAcceptor != nullptr)
|
||||
delete raAcceptor;
|
||||
delete raAcceptor;
|
||||
|
||||
///- Clean database before leaving
|
||||
ClearOnlineAccounts();
|
||||
|
||||
@@ -192,9 +192,7 @@ bool RASession::ProcessCommand(std::string& command)
|
||||
}
|
||||
|
||||
// Obtain a new promise per command
|
||||
if (_commandExecuting != nullptr)
|
||||
delete _commandExecuting;
|
||||
|
||||
delete _commandExecuting;
|
||||
_commandExecuting = new std::promise<void>();
|
||||
|
||||
CliCommandHolder* cmd = new CliCommandHolder(this, command.c_str(), &RASession::CommandPrint, &RASession::CommandFinished);
|
||||
|
||||
Reference in new issue
Block a user