Core/Misc: Fix appleclang 12 warnings

This commit is contained in:
Shauren
2021-10-01 11:18:29 +02:00
parent 7e96b2d733
commit 3bf6698116
9 changed files with 19 additions and 18 deletions

View File

@@ -96,7 +96,7 @@ void WorldSession::HandleBlackMarketBidOnItem(WorldPackets::BlackMarket::BlackMa
if (!entry->ValidateBid(blackMarketBidOnItem.BidAmount))
{
TC_LOG_DEBUG("network", "WORLD: HandleBlackMarketBidOnItem - Player (%s, name: %s) tried to place an invalid bid. Amount: %lu (MarketId: %i).", player->GetGUID().ToString().c_str(), player->GetName().c_str(), blackMarketBidOnItem.BidAmount, blackMarketBidOnItem.MarketID);
TC_LOG_DEBUG("network", "WORLD: HandleBlackMarketBidOnItem - Player (%s, name: %s) tried to place an invalid bid. Amount: " UI64FMTD " (MarketId: %i).", player->GetGUID().ToString().c_str(), player->GetName().c_str(), blackMarketBidOnItem.BidAmount, blackMarketBidOnItem.MarketID);
SendBlackMarketBidOnItemResult(ERR_BMAH_HIGHER_BID, blackMarketBidOnItem.MarketID, blackMarketBidOnItem.Item);
return;
}

View File

@@ -250,7 +250,7 @@ void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* player)
auto itr = _lootItemStore.find(loot->containerID.GetCounter());
if (itr != _lootItemStore.end())
{
TC_LOG_ERROR("misc", "Trying to store item loot by player: %s for container id: %lu that is already in storage!", player->GetGUID().ToString().c_str(), loot->containerID.GetCounter());
TC_LOG_ERROR("misc", "Trying to store item loot by player: %s for container id: " UI64FMTD " that is already in storage!", player->GetGUID().ToString().c_str(), loot->containerID.GetCounter());
return;
}
}

View File

@@ -784,7 +784,7 @@ void PoolMgr::LoadFromDB()
// Now check for circular reference
// All pool_ids are in pool_template
for (auto const it : mPoolTemplate)
for (auto const& it : mPoolTemplate)
{
std::set<uint32> checkedPools;
for (SearchMap::iterator poolItr = mPoolSearchMap.find(it.first); poolItr != mPoolSearchMap.end(); poolItr = mPoolSearchMap.find(poolItr->second))

View File

@@ -523,7 +523,7 @@ inline bool ValidateFields(TableStruct const& ts, std::string const& str, size_t
s = str.find("` (`");
if (s == std::string::npos)
{
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " UI64FMTD ") dump format not recognized.", lineNumber);
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " SZFMTD ") dump format not recognized.", lineNumber);
return false;
}
s += 4;
@@ -532,7 +532,7 @@ inline bool ValidateFields(TableStruct const& ts, std::string const& str, size_t
std::string::size_type e = str.find('`', s);
if (e == std::string::npos || valPos == std::string::npos)
{
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " UI64FMTD ") unexpected end of line", lineNumber);
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " SZFMTD ") unexpected end of line", lineNumber);
return false;
}
@@ -542,7 +542,7 @@ inline bool ValidateFields(TableStruct const& ts, std::string const& str, size_t
int32 columnIndex = GetColumnIndexByName(ts, column);
if (columnIndex == -1)
{
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " UI64FMTD ") unknown column name `%s` for table `%s`, aborting due to incompatible DB structure.", lineNumber, column.c_str(), ts.TableName.c_str());
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " SZFMTD ") unknown column name `%s` for table `%s`, aborting due to incompatible DB structure.", lineNumber, column.c_str(), ts.TableName.c_str());
return false;
}
@@ -944,7 +944,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
std::string tn = GetTableName(line);
if (tn.empty())
{
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " UI64FMTD ") Can't extract table name!", lineNumber);
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " SZFMTD ") Can't extract table name!", lineNumber);
return DUMP_FILE_BROKEN;
}
@@ -961,7 +961,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
if (i == DUMP_TABLE_COUNT)
{
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " UI64FMTD ") Unknown table: `%s`!", lineNumber, tn.c_str());
TC_LOG_ERROR("misc", "LoadPlayerDump: (line " SZFMTD ") Unknown table: `%s`!", lineNumber, tn.c_str());
return DUMP_FILE_BROKEN;
}

View File

@@ -147,7 +147,7 @@ struct boss_amanitar : public BossAI
switch (eventId)
{
case EVENT_SPAWN:
for (Position const pos : MushroomPositions)
for (Position const& pos : MushroomPositions)
SpawnMushroom(pos);
break;
case EVENT_MINI:

View File

@@ -416,7 +416,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
}
break;
case DATA_DESPAWN_SNOBOLDS:
for (ObjectGuid const guid : snoboldGUIDS)
for (ObjectGuid guid : snoboldGUIDS)
if (Creature* snobold = instance->GetCreature(guid))
snobold->DespawnOrUnsummon();
snoboldGUIDS.clear();

View File

@@ -23,6 +23,7 @@ SDCategory: Instance Script
EndScriptData */
#include "ScriptMgr.h"
#include "Containers.h"
#include "MotionMaster.h"
#include "oculus.h"
#include "ScriptedCreature.h"
@@ -102,7 +103,7 @@ class boss_urom : public CreatureScript
for (uint8 i = 0; i < 3; ++i)
group[i] = i;
std::random_shuffle(group, group + 3);
Trinity::Containers::RandomShuffle(group);
}
void Initialize()

View File

@@ -229,7 +229,7 @@ struct boss_shade_of_akama : public BossAI
events.Reset();
summons.DespawnAll();
for (ObjectGuid const spawnerGuid : _spawners)
for (ObjectGuid spawnerGuid : _spawners)
if (Creature* spawner = ObjectAccessor::GetCreature(*me, spawnerGuid))
spawner->AI()->DoAction(ACTION_DESPAWN_ALL_SPAWNS);
@@ -261,7 +261,7 @@ struct boss_shade_of_akama : public BossAI
me->SetWalk(false);
events.ScheduleEvent(EVENT_ADD_THREAT, Milliseconds(100));
for (ObjectGuid const spawnerGuid : _spawners)
for (ObjectGuid spawnerGuid : _spawners)
if (Creature* spawner = ObjectAccessor::GetCreature(*me, spawnerGuid))
spawner->AI()->DoAction(ACTION_STOP_SPAWNING);
}
@@ -274,7 +274,7 @@ struct boss_shade_of_akama : public BossAI
if (Creature* akama = instance->GetCreature(DATA_AKAMA_SHADE))
akama->AI()->DoAction(ACTION_SHADE_OF_AKAMA_DEAD);
for (ObjectGuid const spawnerGuid : _spawners)
for (ObjectGuid spawnerGuid : _spawners)
if (Creature* spawner = ObjectAccessor::GetCreature(*me, spawnerGuid))
spawner->AI()->DoAction(ACTION_DESPAWN_ALL_SPAWNS);
@@ -316,11 +316,11 @@ struct boss_shade_of_akama : public BossAI
}
case EVENT_START_CHANNELERS_AND_SPAWNERS:
{
for (ObjectGuid const summonGuid : summons)
for (ObjectGuid summonGuid : summons)
if (Creature* channeler = ObjectAccessor::GetCreature(*me, summonGuid))
channeler->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
for (ObjectGuid const spawnerGuid : _spawners)
for (ObjectGuid spawnerGuid : _spawners)
if (Creature* spawner = ObjectAccessor::GetCreature(*me, spawnerGuid))
spawner->AI()->DoAction(ACTION_START_SPAWNING);

View File

@@ -83,7 +83,7 @@ char* DB2DatabaseLoader::Load(bool custom, uint32& records, char**& indexTable,
memset(tempDataTable, 0, result->GetRowCount() * recordSize);
uint32* newIndexes = new uint32[result->GetRowCount()];
if (stringFields)
stringPool.reserve(std::max(stringPool.capacity(), stringPool.size() + stringFields * result->GetRowCount() + 1));
stringPool.reserve(std::max<uint64>(stringPool.capacity(), stringPool.size() + stringFields * result->GetRowCount() + 1));
uint32 rec = 0;
uint32 newRecords = 0;
@@ -218,7 +218,7 @@ void DB2DatabaseLoader::LoadStrings(bool custom, LocaleConstant locale, uint32 r
uint32 fieldCount = _loadInfo->Meta->FieldCount;
uint32 recordSize = _loadInfo->Meta->GetRecordSize();
stringPool.reserve(std::max(stringPool.capacity(), stringPool.size() + stringFields * result->GetRowCount() + 1));
stringPool.reserve(std::max<uint64>(stringPool.capacity(), stringPool.size() + stringFields * result->GetRowCount() + 1));
do
{