diff options
Diffstat (limited to 'src')
21 files changed, 41 insertions, 28 deletions
diff --git a/src/common/DataStores/DB2FileLoader.cpp b/src/common/DataStores/DB2FileLoader.cpp index 71475a2a2d9..fc5337a452e 100644 --- a/src/common/DataStores/DB2FileLoader.cpp +++ b/src/common/DataStores/DB2FileLoader.cpp @@ -20,8 +20,10 @@ #include "DB2Meta.h" #include "Errors.h" #include "Log.h" +#include <limits> #include <sstream> #include <system_error> +#include <cstring> enum class DB2ColumnCompression : uint32 { diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp index d61f7fa60bb..6bb22c567de 100644 --- a/src/common/Debugging/Errors.cpp +++ b/src/common/Debugging/Errors.cpp @@ -35,10 +35,12 @@ #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include <Windows.h> +#include <intrin.h> #define Crash(message) \ ULONG_PTR execeptionArgs[] = { reinterpret_cast<ULONG_PTR>(strdup(message)), reinterpret_cast<ULONG_PTR>(_ReturnAddress()) }; \ RaiseException(EXCEPTION_ASSERTION_FAILURE, 0, 2, execeptionArgs); #else +#include <cstring> // should be easily accessible in gdb extern "C" { TC_COMMON_API char const* TrinityAssertionFailedMessage = nullptr; } #define Crash(message) \ diff --git a/src/common/Threading/ProcessPriority.cpp b/src/common/Threading/ProcessPriority.cpp index 3428a56258c..aafc1c49b04 100644 --- a/src/common/Threading/ProcessPriority.cpp +++ b/src/common/Threading/ProcessPriority.cpp @@ -21,6 +21,7 @@ #ifdef _WIN32 // Windows #include <Windows.h> #elif defined(__linux__) +#include <cstring> #include <sched.h> #include <sys/resource.h> #define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0 diff --git a/src/server/database/Database/Field.cpp b/src/server/database/Database/Field.cpp index 258bc2078fb..802bd0291d8 100644 --- a/src/server/database/Database/Field.cpp +++ b/src/server/database/Database/Field.cpp @@ -19,6 +19,7 @@ #include "Errors.h" #include "Log.h" #include "MySQLHacks.h" +#include <cstring> Field::Field() { diff --git a/src/server/database/Database/MySQLPreparedStatement.cpp b/src/server/database/Database/MySQLPreparedStatement.cpp index 30205d68fa2..3d787d956ae 100644 --- a/src/server/database/Database/MySQLPreparedStatement.cpp +++ b/src/server/database/Database/MySQLPreparedStatement.cpp @@ -20,6 +20,7 @@ #include "Log.h" #include "MySQLHacks.h" #include "PreparedStatement.h" +#include <cstring> template<typename T> struct MySQLType { }; diff --git a/src/server/database/Database/QueryResult.cpp b/src/server/database/Database/QueryResult.cpp index 2bc85fc5006..9d069deb925 100644 --- a/src/server/database/Database/QueryResult.cpp +++ b/src/server/database/Database/QueryResult.cpp @@ -21,6 +21,7 @@ #include "Log.h" #include "MySQLHacks.h" #include "MySQLWorkaround.h" +#include <cstring> namespace { diff --git a/src/server/database/Database/Transaction.cpp b/src/server/database/Database/Transaction.cpp index 0bcc905e59f..5df29a99027 100644 --- a/src/server/database/Database/Transaction.cpp +++ b/src/server/database/Database/Transaction.cpp @@ -23,6 +23,7 @@ #include <mysqld_error.h> #include <sstream> #include <thread> +#include <cstring> std::mutex TransactionTask::_deadlockLock; diff --git a/src/server/game/Chat/ChatCommands/ChatCommandTags.h b/src/server/game/Chat/ChatCommands/ChatCommandTags.h index c7f7d0c0029..39fda4c7c0e 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandTags.h +++ b/src/server/game/Chat/ChatCommands/ChatCommandTags.h @@ -26,9 +26,9 @@ #include "Util.h" #include <boost/preprocessor/repetition/repeat.hpp> #include <boost/preprocessor/punctuation/comma_if.hpp> +#include <fmt/ostream.h> #include <cmath> #include <cstring> -#include <iostream> #include <string> #include <string_view> #include <tuple> @@ -154,7 +154,7 @@ namespace Trinity::ChatCommands operator uint32() const { return _id; } operator std::string const& () const { return _name; } - operator std::string_view() const { return { _name }; } + operator std::string_view() const { return _name; } uint32 GetID() const { return _id; } std::string const& GetName() const { return _name; } diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index a24540434f4..69177e832c8 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -540,7 +540,7 @@ void LoadDB2(std::bitset<TOTAL_LOCALES>& availableDb2Locales, std::vector<std::s { if (e.code() == std::errc::no_such_file_or_directory) { - errlist.push_back(Trinity::StringFormat("File %s does not exist", db2Path + localeNames[defaultLocale] + '/' + storage->GetFileName())); + errlist.push_back(Trinity::StringFormat("File %s%s/%s does not exist", db2Path.c_str(), localeNames[defaultLocale], storage->GetFileName().c_str())); } else throw; diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 758e0989af0..8b183c71892 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -740,7 +740,7 @@ void WorldSession::HandleAuctionSellCommodity(WorldPackets::AuctionHouse::Auctio { Item* logItem = items2.begin()->second.first; sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: " UI64FMTD ")", - GetPlayerName().c_str(), GetAccountId(), logItem->GetNameForLocaleIdx(sWorld->GetDefaultDbcLocale()), logItem->GetEntry(), totalCount); + GetPlayerName().c_str(), GetAccountId(), logItem->GetNameForLocaleIdx(sWorld->GetDefaultDbcLocale()).c_str(), logItem->GetEntry(), totalCount); } CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 1f27bda664a..7d0a4aca2c6 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -208,7 +208,7 @@ char const* Warden::ApplyPenalty(WardenCheck const* check) std::string banReason = "Warden Anticheat Violation"; // Check can be NULL, for example if the client sent a wrong signature in the warden packet (CHECKSUM FAIL) if (check) - banReason += Trinity::StringFormat(": %s (CheckId: %u", check->Comment, uint32(check->CheckId)); + banReason += Trinity::StringFormat(": %s (CheckId: %u", check->Comment.c_str(), uint32(check->CheckId)); sWorld->BanAccount(BAN_ACCOUNT, accountName, sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_BAN_DURATION), banReason, "Server"); diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 7fff6a69cce..66f86f16e61 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -111,7 +111,7 @@ void WardenCheckMgr::LoadWardenChecks() continue; } - std::string str = fmt::sprintf("%04u", id); + std::string str = Trinity::StringFormat("%04u", id); ASSERT(str.size() == 4); std::copy(str.begin(), str.end(), wardenCheck.IdStr.begin()); } diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 7ae7baa75ff..bca622225d9 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -153,7 +153,7 @@ public: } // new suggestion, or no token specified, output TOTP parameters - handler->PSendSysMessage(LANG_2FA_SECRET_SUGGESTION, Trinity::Encoding::Base32::Encode(pair.first->second)); + handler->PSendSysMessage(LANG_2FA_SECRET_SUGGESTION, Trinity::Encoding::Base32::Encode(pair.first->second).c_str()); handler->SetSentErrorMessage(true); return false; } @@ -259,7 +259,7 @@ public: switch (sAccountMgr->CreateAccount(accountName, password, email.value_or(""))) { case AccountOpResult::AOR_OK: - handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); + handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName.c_str()); if (handler->GetSession()) { TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] %s) created Account %s (Email: '%s')", @@ -281,11 +281,11 @@ public: handler->SetSentErrorMessage(true); return false; case AccountOpResult::AOR_DB_INTERNAL_ERROR: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName); + handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName.c_str()); handler->SetSentErrorMessage(true); return false; default: - handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, accountName); + handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, accountName.c_str()); handler->SetSentErrorMessage(true); return false; } diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp index 1bcb04b99c0..e8aefb5b844 100644 --- a/src/server/scripts/Commands/cs_arena.cpp +++ b/src/server/scripts/Commands/cs_arena.cpp @@ -62,7 +62,7 @@ public: { if (sArenaTeamMgr->GetArenaTeamByName(name)) { - handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, name); + handler->PSendSysMessage(LANG_ARENA_ERROR_NAME_EXISTS, name.c_str()); handler->SetSentErrorMessage(true); return false; } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index c562990dec6..1475ad8e180 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -909,7 +909,7 @@ public: return false; } - handler->PSendSysMessage("Threat info for %s (%s):", target->GetName(), target->GetGUID().ToString().c_str()); + handler->PSendSysMessage("Threat info for %s (%s):", target->GetName().c_str(), target->GetGUID().ToString().c_str()); ThreatManager const& mgr = target->GetThreatManager(); @@ -1468,7 +1468,7 @@ public: ASSERT(groupData); // checked by objectmgr on load if (explain) { - handler->PSendSysMessage(" |-- '%s' (%u)", groupData->name, pair.first); + handler->PSendSysMessage(" |-- '%s' (%u)", groupData->name.c_str(), pair.first); bool isBlocked = false, isSpawned = false; for (auto const& tuple : pair.second) { @@ -1481,29 +1481,29 @@ public: { isSpawned = true; if (isBlocked) - handler->PSendSysMessage(" | |-- '%s' would be allowed to spawn by boss state %u being %s, but this is overruled", groupData->name, bossStateId, InstanceScript::GetBossStateName(actualState)); + handler->PSendSysMessage(" | |-- '%s' would be allowed to spawn by boss state %u being %s, but this is overruled", groupData->name.c_str(), bossStateId, InstanceScript::GetBossStateName(actualState)); else - handler->PSendSysMessage(" | |-- '%s' is allowed to spawn because boss state %u is %s.", groupData->name, bossStateId, InstanceScript::GetBossStateName(bossStateId)); + handler->PSendSysMessage(" | |-- '%s' is allowed to spawn because boss state %u is %s.", groupData->name.c_str(), bossStateId, InstanceScript::GetBossStateName(bossStateId)); } else { isBlocked = true; - handler->PSendSysMessage(" | |-- '%s' is blocked from spawning because boss state %u is %s.", groupData->name, bossStateId, InstanceScript::GetBossStateName(bossStateId)); + handler->PSendSysMessage(" | |-- '%s' is blocked from spawning because boss state %u is %s.", groupData->name.c_str(), bossStateId, InstanceScript::GetBossStateName(bossStateId)); } } else handler->PSendSysMessage(" | |-- '%s' could've been %s if boss state %u matched mask 0x%02x; but it is %s -> 0x%02x, which does not match.", - groupData->name, isSpawn ? "allowed to spawn" : "blocked from spawning", bossStateId, std::get<2>(tuple), InstanceScript::GetBossStateName(actualState), (1 << actualState)); + groupData->name.c_str(), isSpawn ? "allowed to spawn" : "blocked from spawning", bossStateId, std::get<2>(tuple), InstanceScript::GetBossStateName(actualState), (1 << actualState)); } if (isBlocked) - handler->PSendSysMessage(" | |=> '%s' is not active due to a blocking rule being matched", groupData->name); + handler->PSendSysMessage(" | |=> '%s' is not active due to a blocking rule being matched", groupData->name.c_str()); else if (isSpawned) - handler->PSendSysMessage(" | |=> '%s' is active due to a spawn rule being matched", groupData->name); + handler->PSendSysMessage(" | |=> '%s' is active due to a spawn rule being matched", groupData->name.c_str()); else - handler->PSendSysMessage(" | |=> '%s' is not active due to none of its rules being matched", groupData->name); + handler->PSendSysMessage(" | |=> '%s' is not active due to none of its rules being matched", groupData->name.c_str()); } else - handler->PSendSysMessage(" - '%s' (%u) is %sactive", groupData->name, pair.first, map->IsSpawnGroupActive(pair.first) ? "" : "not "); + handler->PSendSysMessage(" - '%s' (%u) is %sactive", groupData->name.c_str(), pair.first, map->IsSpawnGroupActive(pair.first) ? "" : "not "); } return true; } diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 34e8cae35a4..dddbd0ed0ce 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -321,12 +321,12 @@ public: if (GameObject::DeleteFromDB(spawnId)) { - handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, std::to_string(spawnId)); + handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, std::to_string(spawnId).c_str()); return true; } else { - handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, std::to_string(spawnId)); + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, std::to_string(spawnId).c_str()); handler->SetSentErrorMessage(true); return false; } @@ -560,7 +560,7 @@ public: { float yaw, pitch, roll; spawnData->rotation.toEulerAnglesZYX(yaw, pitch, roll); - handler->PSendSysMessage(LANG_SPAWNINFO_SPAWNID_LOCATION, std::to_string(spawnData->spawnId), spawnData->spawnPoint.GetPositionX(), spawnData->spawnPoint.GetPositionY(), spawnData->spawnPoint.GetPositionZ()); + handler->PSendSysMessage(LANG_SPAWNINFO_SPAWNID_LOCATION, std::to_string(spawnData->spawnId).c_str(), spawnData->spawnPoint.GetPositionX(), spawnData->spawnPoint.GetPositionY(), spawnData->spawnPoint.GetPositionZ()); handler->PSendSysMessage(LANG_SPAWNINFO_ROTATION, yaw, pitch, roll); } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index b2ad46337ef..547574d0d9f 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -336,7 +336,7 @@ public: } else { - handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, std::to_string(spawnId)); + handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, std::to_string(spawnId).c_str()); handler->SetSentErrorMessage(true); return false; } @@ -1190,7 +1190,7 @@ public: if (!pair.second) continue; Player const* player = ObjectAccessor::FindConnectedPlayer(pair.first); - handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_SUBLABEL, player ? player->GetName() : Trinity::StringFormat("Offline player (GUID %s)", pair.first.ToString()).c_str(), pair.second->size()); + handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_SUBLABEL, player ? player->GetName().c_str() : Trinity::StringFormat("Offline player (GUID %s)", pair.first.ToString().c_str()).c_str(), pair.second->size()); for (auto it = pair.second->cbegin(); it != pair.second->cend(); ++it) { @@ -1213,12 +1213,12 @@ public: Loot const& loot = creatureTarget->loot; if (!creatureTarget->isDead() || loot.empty()) { - handler->PSendSysMessage(LANG_COMMAND_NOT_DEAD_OR_NO_LOOT, creatureTarget->GetName()); + handler->PSendSysMessage(LANG_COMMAND_NOT_DEAD_OR_NO_LOOT, creatureTarget->GetName().c_str()); handler->SetSentErrorMessage(true); return false; } - handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_HEADER, creatureTarget->GetName(), creatureTarget->GetEntry()); + handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_HEADER, creatureTarget->GetName().c_str(), creatureTarget->GetEntry()); handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_MONEY, loot.gold / GOLD, (loot.gold%GOLD) / SILVER, loot.gold%SILVER); if (!all) diff --git a/src/server/shared/DataStores/DB2DatabaseLoader.cpp b/src/server/shared/DataStores/DB2DatabaseLoader.cpp index 547fec40e37..33053d4b928 100644 --- a/src/server/shared/DataStores/DB2DatabaseLoader.cpp +++ b/src/server/shared/DataStores/DB2DatabaseLoader.cpp @@ -21,6 +21,7 @@ #include "DB2Meta.h" #include "Errors.h" #include "Log.h" +#include <cstring> DB2LoadInfo::DB2LoadInfo(DB2FieldMeta const* fields, std::size_t fieldCount, DB2Meta const* meta, HotfixDatabaseStatements statement) : DB2FileLoadInfo(fields, fieldCount, meta), Statement(statement) diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index f8470332893..11029ae1a10 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -22,6 +22,7 @@ #include "Util.h" #include <utf8.h> #include <sstream> +#include <cmath> #include <ctime> ByteBuffer::ByteBuffer(MessageBuffer&& buffer) : _rpos(0), _wpos(0), _bitpos(InitialBitPos), _curbitval(0), _storage(buffer.Move()) diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index 168f4181358..737f774bead 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -26,6 +26,7 @@ #include "vmapexport.h" #include "wdtfile.h" #include "wmo.h" +#include <algorithm> #include <CascLib.h> #include <boost/filesystem/operations.hpp> #include <fstream> diff --git a/src/tools/vmap4_extractor/wmo.cpp b/src/tools/vmap4_extractor/wmo.cpp index f744b4557f7..fc4265cda59 100644 --- a/src/tools/vmap4_extractor/wmo.cpp +++ b/src/tools/vmap4_extractor/wmo.cpp @@ -23,6 +23,7 @@ #include "vec3d.h" #include "VMapDefinitions.h" #include "wmo.h" +#include <algorithm> #include <fstream> #include <map> #include <cstdio> |