diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-05-13 11:41:54 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2025-05-26 20:49:46 +0200 |
commit | 4696aecf170acc6b98301132766ac5e17d574cdf (patch) | |
tree | 24ec6324ccdc0bbb8915e7e625b863b9a5c37c51 /src | |
parent | f8f7d95c5d75cfa4088c6cb2f01fb7275315caba (diff) |
Core/Misc: Make string and string_view literal suffixes globally available
(cherry picked from commit 546d23264c8886cad0dc03f2df9c64e999c8573a)
# Conflicts:
# src/common/Configuration/Config.cpp
# src/server/game/Chat/Hyperlinks.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/common/Common.h | 3 | ||||
-rw-r--r-- | src/common/Configuration/Config.cpp | 1 | ||||
-rw-r--r-- | src/common/Cryptography/Authentication/SRP6.cpp | 3 | ||||
-rw-r--r-- | src/server/bnetserver/REST/LoginHttpSession.cpp | 1 | ||||
-rw-r--r-- | src/server/bnetserver/REST/LoginRESTService.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Entities/Item/Item.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Object/ObjectGuid.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_account.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_battlenet_account.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 2 | ||||
-rw-r--r-- | src/server/shared/Packets/ByteBuffer.h | 2 |
14 files changed, 7 insertions, 23 deletions
diff --git a/src/common/Common.h b/src/common/Common.h index 847b296d1a4..208809dcdfc 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -22,6 +22,9 @@ #include <array> #include <string> +using namespace std::string_literals; +using namespace std::string_view_literals; + #define STRINGIZE(a) #a enum TimeConstants diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index 62404ec7cad..0da4bd117a2 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -16,6 +16,7 @@ */ #include "Config.h" +#include "Common.h" #include "Log.h" #include "StringConvert.h" #include <boost/filesystem/directory.hpp> diff --git a/src/common/Cryptography/Authentication/SRP6.cpp b/src/common/Cryptography/Authentication/SRP6.cpp index e015b8c33f6..25ed10de56a 100644 --- a/src/common/Cryptography/Authentication/SRP6.cpp +++ b/src/common/Cryptography/Authentication/SRP6.cpp @@ -16,14 +16,13 @@ */ #include "SRP6.h" +#include "Common.h" #include "CryptoRandom.h" #include <algorithm> #include <functional> namespace Trinity::Crypto::SRP { -using namespace std::string_literals; - BigNumber const GruntSRP6::N = "894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"s; BigNumber const GruntSRP6::g = 7; diff --git a/src/server/bnetserver/REST/LoginHttpSession.cpp b/src/server/bnetserver/REST/LoginHttpSession.cpp index d1c38d667d9..035dff6b243 100644 --- a/src/server/bnetserver/REST/LoginHttpSession.cpp +++ b/src/server/bnetserver/REST/LoginHttpSession.cpp @@ -30,7 +30,6 @@ namespace { std::shared_ptr<Trinity::Net::Http::SessionState> ObtainSessionState(Trinity::Net::Http::RequestContext& context, boost::asio::ip::address const& remoteAddress) { - using namespace std::string_literals; std::shared_ptr<Trinity::Net::Http::SessionState> state; auto cookieItr = context.request.find(boost::beast::http::field::cookie); if (cookieItr != context.request.end()) diff --git a/src/server/bnetserver/REST/LoginRESTService.cpp b/src/server/bnetserver/REST/LoginRESTService.cpp index 740265cfd4b..b75d8d93ba8 100644 --- a/src/server/bnetserver/REST/LoginRESTService.cpp +++ b/src/server/bnetserver/REST/LoginRESTService.cpp @@ -17,6 +17,7 @@ #include "LoginRESTService.h" #include "Base64.h" +#include "Common.h" #include "Configuration/Config.h" #include "CryptoHash.h" #include "CryptoRandom.h" @@ -42,7 +43,6 @@ bool LoginRESTService::StartNetwork(Trinity::Asio::IoContext& ioContext, std::st if (!HttpService::StartNetwork(ioContext, bindIp, port, threadCount)) return false; - using namespace std::string_view_literals; using Trinity::Net::Http::RequestHandlerFlag; RegisterHandler(boost::beast::http::verb::get, "/bnetserver/login/"sv, [this](std::shared_ptr<LoginHttpSession> session, HttpRequestContext& context) @@ -149,8 +149,6 @@ std::string const& LoginRESTService::GetHostnameForClient(boost::asio::ip::addre std::string LoginRESTService::ExtractAuthorization(HttpRequest const& request) { - using namespace std::string_view_literals; - std::string ticket; auto itr = request.find(boost::beast::http::field::authorization); if (itr == request.end()) diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 6927183dcab..4bda25ccfbe 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -537,8 +537,6 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans) if (m_itemData->Gems.size()) { - using namespace std::string_view_literals; - stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_GEMS); stmt->setUInt64(0, GetGUID().GetCounter()); uint32 i = 0; diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp index a59500e9b48..ea0efd9af04 100644 --- a/src/server/game/Entities/Object/ObjectGuid.cpp +++ b/src/server/game/Entities/Object/ObjectGuid.cpp @@ -669,8 +669,6 @@ namespace ClientFormatFunction[AsUnderlyingType(HighGuid::type)] = &ObjectGuidInfo::format;\ ClientParseFunction[AsUnderlyingType(HighGuid::type)] = &ObjectGuidInfo::parse - using namespace std::string_view_literals; - SET_GUID_INFO(Null, FormatNull, ParseNull); SET_GUID_INFO(Uniq, FormatUniq, ParseUniq); SET_GUID_INFO(Player, FormatPlayer, ParsePlayer); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index bf63f51f465..4aa7b90385c 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -964,8 +964,6 @@ void Player::Update(uint32 p_time) // If mute expired, remove it from the DB if (GetSession()->m_muteTime && GetSession()->m_muteTime < now) { - using namespace std::string_view_literals; - GetSession()->m_muteTime = 0; LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); stmt->setInt64(0, 0); // Set the mute time to 0 diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index a48d30e6e17..a325773335a 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6898,8 +6898,6 @@ bool ObjectMgr::AddGraveyardLink(uint32 id, uint32 zoneId, uint32 team, bool per // Store graveyard condition if team is set if (team != 0) { - using namespace std::string_view_literals; - WorldDatabasePreparedStatement* conditionStmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CONDITION); conditionStmt->setUInt32(0, CONDITION_SOURCE_TYPE_GRAVEYARD); // SourceTypeOrReferenceId conditionStmt->setUInt32(1, zoneId); // SourceGroup diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index ad0fa770a94..1caf56a37f6 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -448,8 +448,6 @@ public: } else { - using namespace std::string_view_literals; - LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY); stmt->setString(0, "00"sv); stmt->setUInt32(1, handler->GetSession()->GetAccountId()); diff --git a/src/server/scripts/Commands/cs_battlenet_account.cpp b/src/server/scripts/Commands/cs_battlenet_account.cpp index 254ff517538..6ef1f8d973b 100644 --- a/src/server/scripts/Commands/cs_battlenet_account.cpp +++ b/src/server/scripts/Commands/cs_battlenet_account.cpp @@ -135,8 +135,6 @@ public: } else { - using namespace std::string_view_literals; - LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_ACCOUNT_LOCK_CONTRY); stmt->setString(0, "00"sv); stmt->setUInt32(1, handler->GetSession()->GetBattlenetAccountId()); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index d250ff2b2c8..bb3fb1861aa 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1973,8 +1973,6 @@ public: target->GetSession()->m_muteTime = 0; } - using namespace std::string_view_literals; - LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME); stmt->setInt64(0, 0); stmt->setString(1, ""sv); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 1d705c675df..9577bac25ba 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1327,8 +1327,6 @@ public: _ShowLootContents(handler, all.has_value(), loot); else { - using namespace std::string_view_literals; - for (auto const& [lootOwner, personalLoot] : creatureTarget->m_personalLoot) { CharacterCacheEntry const* character = sCharacterCache->GetCharacterCacheByGuid(lootOwner); diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 9a4761ff3e0..9e85ad94da1 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -234,7 +234,7 @@ class TC_SHARED_API ByteBuffer uint32 value = 0; if (bits > 8 - int32(_bitpos)) { - // first retriever whatever is left in the bit buffer + // first retrieve whatever is left in the bit buffer int32 bitsInBuffer = 8 - _bitpos; value = (_curbitval & ((UI64LIT(1) << bitsInBuffer) - 1)) << (bits - bitsInBuffer); bits -= bitsInBuffer; |