diff options
200 files changed, 522 insertions, 581 deletions
diff --git a/src/common/Asio/AsioHacksFwd.h b/src/common/Asio/AsioHacksFwd.h index fa49b351db..8746a92fd2 100644 --- a/src/common/Asio/AsioHacksFwd.h +++ b/src/common/Asio/AsioHacksFwd.h @@ -18,8 +18,6 @@ #ifndef AsioHacksFwd_h__ #define AsioHacksFwd_h__ -#include <boost/version.hpp> - /** Collection of forward declarations to improve compile time */ diff --git a/src/common/Asio/Resolver.h b/src/common/Asio/Resolver.h index 45b3c5b79e..a49b8fcda5 100644 --- a/src/common/Asio/Resolver.h +++ b/src/common/Asio/Resolver.h @@ -18,7 +18,6 @@ #ifndef Resolver_h__ #define Resolver_h__ -#include "IoContext.h" #include "Optional.h" #include <boost/asio/ip/tcp.hpp> #include <string> diff --git a/src/common/Collision/DynamicTree.cpp b/src/common/Collision/DynamicTree.cpp index e7538a32ad..aef80fa914 100644 --- a/src/common/Collision/DynamicTree.cpp +++ b/src/common/Collision/DynamicTree.cpp @@ -40,7 +40,7 @@ namespace template<> struct HashTrait< GameObjectModel> { - static size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; } + static std::size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; } }; template<> struct PositionTrait< GameObjectModel> diff --git a/src/common/Collision/Management/IMMAPMgr.h b/src/common/Collision/Management/IMMAPMgr.h index 7ffb7d10e9..e68f0ff488 100644 --- a/src/common/Collision/Management/IMMAPMgr.h +++ b/src/common/Collision/Management/IMMAPMgr.h @@ -18,9 +18,6 @@ #ifndef _IMMAPMANAGER_H #define _IMMAPMANAGER_H -#include "Define.h" -#include <string> - // Interface for IMMapManger namespace MMAP { diff --git a/src/common/Collision/Management/MMapFactory.cpp b/src/common/Collision/Management/MMapFactory.cpp index af0a46cab6..70a57726dd 100644 --- a/src/common/Collision/Management/MMapFactory.cpp +++ b/src/common/Collision/Management/MMapFactory.cpp @@ -17,8 +17,6 @@ #include "MMapFactory.h" #include <cstring> -#include <set> - namespace MMAP { // ######################## MMapFactory ######################## diff --git a/src/common/Collision/Management/MMapFactory.h b/src/common/Collision/Management/MMapFactory.h index 61c6010807..08136b6fc9 100644 --- a/src/common/Collision/Management/MMapFactory.h +++ b/src/common/Collision/Management/MMapFactory.h @@ -18,11 +18,7 @@ #ifndef _MMAP_FACTORY_H #define _MMAP_FACTORY_H -#include "DetourAlloc.h" -#include "DetourExtended.h" -#include "DetourNavMesh.h" #include "MMapMgr.h" -#include <unordered_map> namespace MMAP { diff --git a/src/common/Collision/Management/MMapMgr.cpp b/src/common/Collision/Management/MMapMgr.cpp index 622220c5a3..bb67910573 100644 --- a/src/common/Collision/Management/MMapMgr.cpp +++ b/src/common/Collision/Management/MMapMgr.cpp @@ -174,7 +174,7 @@ namespace MMAP unsigned char* data = (unsigned char*)dtAlloc(fileHeader.size, DT_ALLOC_PERM); ASSERT(data); - size_t result = fread(data, fileHeader.size, 1, file); + std::size_t result = fread(data, fileHeader.size, 1, file); if (!result) { LOG_ERROR("maps", "MMAP:loadMap: Bad header or data in mmap {:03}{:02}{:02}.mmtile", mapId, x, y); diff --git a/src/common/Collision/Management/MMapMgr.h b/src/common/Collision/Management/MMapMgr.h index d6ca2c44cb..013f34292a 100644 --- a/src/common/Collision/Management/MMapMgr.h +++ b/src/common/Collision/Management/MMapMgr.h @@ -22,12 +22,11 @@ #include "DetourAlloc.h" #include "DetourExtended.h" #include "DetourNavMesh.h" -#include <shared_mutex> #include <unordered_map> #include <vector> // memory management -inline void* dtCustomAlloc(size_t size, dtAllocHint /*hint*/) +inline void* dtCustomAlloc(std::size_t size, dtAllocHint /*hint*/) { return (void*)new unsigned char[size]; } diff --git a/src/common/Collision/Management/VMapFactory.h b/src/common/Collision/Management/VMapFactory.h index 512ccb2523..aa6ebd4ee8 100644 --- a/src/common/Collision/Management/VMapFactory.h +++ b/src/common/Collision/Management/VMapFactory.h @@ -18,8 +18,6 @@ #ifndef _VMAPFACTORY_H #define _VMAPFACTORY_H -#include "IVMapMgr.h" - // This is the access point to the VMapMgr. namespace VMAP { diff --git a/src/common/Collision/Management/VMapMgr2.h b/src/common/Collision/Management/VMapMgr2.h index 4c37a95b41..f025c8086c 100644 --- a/src/common/Collision/Management/VMapMgr2.h +++ b/src/common/Collision/Management/VMapMgr2.h @@ -18,7 +18,6 @@ #ifndef _VMAPMANAGER2_H #define _VMAPMANAGER2_H -#include "Common.h" #include "IVMapMgr.h" #include <mutex> #include <unordered_map> diff --git a/src/common/Collision/Models/WorldModel.h b/src/common/Collision/Models/WorldModel.h index b1a268318c..df1bd47512 100644 --- a/src/common/Collision/Models/WorldModel.h +++ b/src/common/Collision/Models/WorldModel.h @@ -21,7 +21,6 @@ #include "BoundingIntervalHierarchy.h" #include "Define.h" #include <G3D/AABox.h> -#include <G3D/HashTrait.h> #include <G3D/Ray.h> #include <G3D/Vector3.h> diff --git a/src/common/Collision/RegularGrid.h b/src/common/Collision/RegularGrid.h index 7de66a39a0..1a24c4258e 100644 --- a/src/common/Collision/RegularGrid.h +++ b/src/common/Collision/RegularGrid.h @@ -1,7 +1,6 @@ #ifndef _REGULAR_GRID_H #define _REGULAR_GRID_H -#include <G3D/BoundsTrait.h> #include <G3D/PositionTrait.h> #include <G3D/Ray.h> #include <G3D/Table.h> diff --git a/src/common/Collision/VMapDefinitions.h b/src/common/Collision/VMapDefinitions.h index c2094a722b..eee744fe45 100644 --- a/src/common/Collision/VMapDefinitions.h +++ b/src/common/Collision/VMapDefinitions.h @@ -17,7 +17,6 @@ #ifndef _VMAPDEFINITIONS_H #define _VMAPDEFINITIONS_H -#include <cstring> #define LIQUID_TILE_SIZE (533.333f / 128.f) diff --git a/src/common/Collision/VMapTools.h b/src/common/Collision/VMapTools.h index 42350df676..f200e3647b 100644 --- a/src/common/Collision/VMapTools.h +++ b/src/common/Collision/VMapTools.h @@ -18,7 +18,6 @@ #ifndef _VMAPTOOLS_H #define _VMAPTOOLS_H -#include "Define.h" #include <G3D/AABox.h> #include <G3D/CollisionDetection.h> diff --git a/src/common/Common.h b/src/common/Common.h index 5f1267199d..cd50104c88 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -19,10 +19,7 @@ #define AZEROTHCORE_COMMON_H #include "Define.h" -#include <array> -#include <memory> #include <string> -#include <utility> #if AC_PLATFORM == AC_PLATFORM_WINDOWS #include <ws2tcpip.h> diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index 0cd69584d3..2261c14b10 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -46,9 +46,9 @@ namespace // Check system configs like *server.conf* bool IsAppConfig(std::string_view fileName) { - size_t foundAuth = fileName.find("authserver.conf"); - size_t foundWorld = fileName.find("worldserver.conf"); - size_t foundImport = fileName.find("dbimport.conf"); + std::size_t foundAuth = fileName.find("authserver.conf"); + std::size_t foundWorld = fileName.find("worldserver.conf"); + std::size_t foundImport = fileName.find("dbimport.conf"); return foundAuth != std::string_view::npos || foundWorld != std::string_view::npos || foundImport != std::string_view::npos; } @@ -56,8 +56,8 @@ namespace // Check logging system configs like Appender.* and Logger.* bool IsLoggingSystemOptions(std::string_view optionName) { - size_t foundAppender = optionName.find("Appender."); - size_t foundLogger = optionName.find("Logger."); + std::size_t foundAppender = optionName.find("Appender."); + std::size_t foundLogger = optionName.find("Logger."); return foundAppender != std::string_view::npos || foundLogger != std::string_view::npos; } @@ -223,7 +223,7 @@ namespace std::string result; const char* str = key.c_str(); - size_t n = key.length(); + std::size_t n = key.length(); char curr; bool isEnd; @@ -231,7 +231,7 @@ namespace bool currIsNumeric; bool nextIsNumeric; - for (size_t i = 0; i < n; ++i) + for (std::size_t i = 0; i < n; ++i) { curr = str[i]; if (curr == ' ' || curr == '.' || curr == '-') diff --git a/src/common/Configuration/Config.h b/src/common/Configuration/Config.h index c7708290e7..ccb35132dd 100644 --- a/src/common/Configuration/Config.h +++ b/src/common/Configuration/Config.h @@ -18,7 +18,6 @@ #ifndef CONFIG_H #define CONFIG_H -#include "Define.h" #include <stdexcept> #include <string_view> #include <vector> diff --git a/src/common/Cryptography/AES.cpp b/src/common/Cryptography/AES.cpp index 31e0847005..f4061cdcbc 100644 --- a/src/common/Cryptography/AES.cpp +++ b/src/common/Cryptography/AES.cpp @@ -37,7 +37,7 @@ void Acore::Crypto::AES::Init(Key const& key) ASSERT(status); } -bool Acore::Crypto::AES::Process(IV const& iv, uint8* data, size_t length, Tag& tag) +bool Acore::Crypto::AES::Process(IV const& iv, uint8* data, std::size_t length, Tag& tag) { ASSERT(length <= static_cast<size_t>(std::numeric_limits<int>::max())); int len = static_cast<int>(length); diff --git a/src/common/Cryptography/AES.h b/src/common/Cryptography/AES.h index c73aeebea2..c49f181831 100644 --- a/src/common/Cryptography/AES.h +++ b/src/common/Cryptography/AES.h @@ -27,9 +27,9 @@ namespace Acore::Crypto class AC_COMMON_API AES { public: - static constexpr size_t IV_SIZE_BYTES = 12; - static constexpr size_t KEY_SIZE_BYTES = 16; - static constexpr size_t TAG_SIZE_BYTES = 12; + static constexpr std::size_t IV_SIZE_BYTES = 12; + static constexpr std::size_t KEY_SIZE_BYTES = 16; + static constexpr std::size_t TAG_SIZE_BYTES = 12; using IV = std::array<uint8, IV_SIZE_BYTES>; using Key = std::array<uint8, KEY_SIZE_BYTES>; @@ -40,7 +40,7 @@ namespace Acore::Crypto void Init(Key const& key); - bool Process(IV const& iv, uint8* data, size_t length, Tag& tag); + bool Process(IV const& iv, uint8* data, std::size_t length, Tag& tag); private: EVP_CIPHER_CTX* _ctx; diff --git a/src/common/Cryptography/ARC4.cpp b/src/common/Cryptography/ARC4.cpp index 90535f7477..10a7ad490c 100644 --- a/src/common/Cryptography/ARC4.cpp +++ b/src/common/Cryptography/ARC4.cpp @@ -40,7 +40,7 @@ Acore::Crypto::ARC4::~ARC4() #endif } -void Acore::Crypto::ARC4::Init(uint8 const* seed, size_t len) +void Acore::Crypto::ARC4::Init(uint8 const* seed, std::size_t len) { int result1 = EVP_CIPHER_CTX_set_key_length(_ctx, len); ASSERT(result1 == 1); @@ -48,7 +48,7 @@ void Acore::Crypto::ARC4::Init(uint8 const* seed, size_t len) ASSERT(result2 == 1); } -void Acore::Crypto::ARC4::UpdateData(uint8* data, size_t len) +void Acore::Crypto::ARC4::UpdateData(uint8* data, std::size_t len) { int outlen = 0; int result1 = EVP_EncryptUpdate(_ctx, data, &outlen, data, len); diff --git a/src/common/Cryptography/ARC4.h b/src/common/Cryptography/ARC4.h index f598589a29..7f4f0dc532 100644 --- a/src/common/Cryptography/ARC4.h +++ b/src/common/Cryptography/ARC4.h @@ -30,12 +30,12 @@ namespace Acore::Crypto ARC4(); ~ARC4(); - void Init(uint8 const* seed, size_t len); + void Init(uint8 const* seed, std::size_t len); template <typename Container> void Init(Container const& c) { Init(std::data(c), std::size(c)); } - void UpdateData(uint8* data, size_t len); + void UpdateData(uint8* data, std::size_t len); template <typename Container> void UpdateData(Container& c) { UpdateData(std::data(c), std::size(c)); } diff --git a/src/common/Cryptography/Authentication/AuthCrypt.cpp b/src/common/Cryptography/Authentication/AuthCrypt.cpp index 21115ed155..26084f76ab 100644 --- a/src/common/Cryptography/Authentication/AuthCrypt.cpp +++ b/src/common/Cryptography/Authentication/AuthCrypt.cpp @@ -35,13 +35,13 @@ void AuthCrypt::Init(SessionKey const& K) _initialized = true; } -void AuthCrypt::DecryptRecv(uint8* data, size_t len) +void AuthCrypt::DecryptRecv(uint8* data, std::size_t len) { ASSERT(_initialized); _clientDecrypt.UpdateData(data, len); } -void AuthCrypt::EncryptSend(uint8* data, size_t len) +void AuthCrypt::EncryptSend(uint8* data, std::size_t len) { ASSERT(_initialized); _serverEncrypt.UpdateData(data, len); diff --git a/src/common/Cryptography/Authentication/AuthCrypt.h b/src/common/Cryptography/Authentication/AuthCrypt.h index 88239a9e36..3a7ff89df9 100644 --- a/src/common/Cryptography/Authentication/AuthCrypt.h +++ b/src/common/Cryptography/Authentication/AuthCrypt.h @@ -27,8 +27,8 @@ public: AuthCrypt() = default; void Init(SessionKey const& K); - void DecryptRecv(uint8* data, size_t len); - void EncryptSend(uint8* data, size_t len); + void DecryptRecv(uint8* data, std::size_t len); + void EncryptSend(uint8* data, std::size_t len); bool IsInitialized() const { return _initialized; } diff --git a/src/common/Cryptography/Authentication/AuthDefines.h b/src/common/Cryptography/Authentication/AuthDefines.h index 85d0dbf494..3de2a02fbe 100644 --- a/src/common/Cryptography/Authentication/AuthDefines.h +++ b/src/common/Cryptography/Authentication/AuthDefines.h @@ -21,7 +21,7 @@ #include "Define.h" #include <array> -constexpr size_t SESSION_KEY_LENGTH = 40; +constexpr std::size_t SESSION_KEY_LENGTH = 40; using SessionKey = std::array<uint8, SESSION_KEY_LENGTH>; #endif diff --git a/src/common/Cryptography/Authentication/SRP6.cpp b/src/common/Cryptography/Authentication/SRP6.cpp index 20e05f5b2b..e89ac99a74 100644 --- a/src/common/Cryptography/Authentication/SRP6.cpp +++ b/src/common/Cryptography/Authentication/SRP6.cpp @@ -51,14 +51,14 @@ using SRP6 = Acore::Crypto::SRP6; { // split S into two buffers std::array<uint8, EPHEMERAL_KEY_LENGTH / 2> buf0{}, buf1{}; - for (size_t i = 0; i < EPHEMERAL_KEY_LENGTH / 2; ++i) + for (std::size_t i = 0; i < EPHEMERAL_KEY_LENGTH / 2; ++i) { buf0[i] = S[2 * i + 0]; buf1[i] = S[2 * i + 1]; } // find position of first nonzero byte - size_t p = 0; + std::size_t p = 0; while (p < EPHEMERAL_KEY_LENGTH && !S[p]) ++p; @@ -73,7 +73,7 @@ using SRP6 = Acore::Crypto::SRP6; // stick the two hashes back together SessionKey K; - for (size_t i = 0; i < SHA1::DIGEST_LENGTH; ++i) + for (std::size_t i = 0; i < SHA1::DIGEST_LENGTH; ++i) { K[2 * i + 0] = hash0[i]; K[2 * i + 1] = hash1[i]; diff --git a/src/common/Cryptography/Authentication/SRP6.h b/src/common/Cryptography/Authentication/SRP6.h index 734ef12980..d7f288dc39 100644 --- a/src/common/Cryptography/Authentication/SRP6.h +++ b/src/common/Cryptography/Authentication/SRP6.h @@ -28,13 +28,13 @@ namespace Acore::Crypto class AC_COMMON_API SRP6 { public: - static constexpr size_t SALT_LENGTH = 32; + static constexpr std::size_t SALT_LENGTH = 32; using Salt = std::array<uint8, SALT_LENGTH>; - static constexpr size_t VERIFIER_LENGTH = 32; + static constexpr std::size_t VERIFIER_LENGTH = 32; using Verifier = std::array<uint8, VERIFIER_LENGTH>; - static constexpr size_t EPHEMERAL_KEY_LENGTH = 32; + static constexpr std::size_t EPHEMERAL_KEY_LENGTH = 32; using EphemeralKey = std::array<uint8, EPHEMERAL_KEY_LENGTH>; static std::array<uint8, 1> const g; diff --git a/src/common/Cryptography/BigNumber.cpp b/src/common/Cryptography/BigNumber.cpp index 1cd8d6a199..decfeecbe5 100644 --- a/src/common/Cryptography/BigNumber.cpp +++ b/src/common/Cryptography/BigNumber.cpp @@ -195,7 +195,7 @@ bool BigNumber::IsNegative() const return BN_is_negative(_bn); } -void BigNumber::GetBytes(uint8* buf, size_t bufsize, bool littleEndian) const +void BigNumber::GetBytes(uint8* buf, std::size_t bufsize, bool littleEndian) const { #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10100000L int nBytes = GetNumBytes(); diff --git a/src/common/Cryptography/BigNumber.h b/src/common/Cryptography/BigNumber.h index 259fa92ed2..591da4e67a 100644 --- a/src/common/Cryptography/BigNumber.h +++ b/src/common/Cryptography/BigNumber.h @@ -34,7 +34,7 @@ public: BigNumber(int32 v) : BigNumber() { SetDword(v); } BigNumber(std::string const& v) : BigNumber() { SetHexStr(v); } - template <size_t Size> + template <std::size_t Size> BigNumber(std::array<uint8, Size> const& v, bool littleEndian = true) : BigNumber() { SetBinary(v.data(), Size, littleEndian); } ~BigNumber(); @@ -116,7 +116,7 @@ public: [[nodiscard]] uint32 AsDword() const; - void GetBytes(uint8* buf, size_t bufsize, bool littleEndian = true) const; + void GetBytes(uint8* buf, std::size_t bufsize, bool littleEndian = true) const; [[nodiscard]] std::vector<uint8> ToByteVector(int32 minSize = 0, bool littleEndian = true) const; template <std::size_t Size> diff --git a/src/common/Cryptography/CryptoConstants.h b/src/common/Cryptography/CryptoConstants.h index 3ba8b55d6a..7fadc4f366 100644 --- a/src/common/Cryptography/CryptoConstants.h +++ b/src/common/Cryptography/CryptoConstants.h @@ -18,15 +18,13 @@ #ifndef AZEROTHCORE_CRYPTO_CONSTANTS_H #define AZEROTHCORE_CRYPTO_CONSTANTS_H -#include "Define.h" - namespace Acore::Crypto { struct Constants { - static constexpr size_t MD5_DIGEST_LENGTH_BYTES = 16; - static constexpr size_t SHA1_DIGEST_LENGTH_BYTES = 20; - static constexpr size_t SHA256_DIGEST_LENGTH_BYTES = 32; + static constexpr std::size_t MD5_DIGEST_LENGTH_BYTES = 16; + static constexpr std::size_t SHA1_DIGEST_LENGTH_BYTES = 20; + static constexpr std::size_t SHA256_DIGEST_LENGTH_BYTES = 32; }; } diff --git a/src/common/Cryptography/CryptoGenerics.h b/src/common/Cryptography/CryptoGenerics.h index d4b799747c..3e84c6b3ec 100644 --- a/src/common/Cryptography/CryptoGenerics.h +++ b/src/common/Cryptography/CryptoGenerics.h @@ -47,7 +47,7 @@ namespace Acore::Impl static void SplitFromBack(std::vector<uint8>& data, Container& tail) { ASSERT(data.size() >= std::size(tail)); - for (size_t i = 1, N = std::size(tail); i <= N; ++i) + for (std::size_t i = 1, N = std::size(tail); i <= N; ++i) { tail[N - i] = data.back(); data.pop_back(); diff --git a/src/common/Cryptography/CryptoHash.h b/src/common/Cryptography/CryptoHash.h index 1763351bc7..6b98c5cd5b 100644 --- a/src/common/Cryptography/CryptoHash.h +++ b/src/common/Cryptography/CryptoHash.h @@ -43,14 +43,14 @@ namespace Acore::Impl #endif }; - template <GenericHashImpl::HashCreator HashCreator, size_t DigestLength> + template <GenericHashImpl::HashCreator HashCreator, std::size_t DigestLength> class GenericHash { public: - static constexpr size_t DIGEST_LENGTH = DigestLength; + static constexpr std::size_t DIGEST_LENGTH = DigestLength; using Digest = std::array<uint8, DIGEST_LENGTH>; - static Digest GetDigestOf(uint8 const* data, size_t len) + static Digest GetDigestOf(uint8 const* data, std::size_t len) { GenericHash hash; hash.UpdateData(data, len); @@ -112,7 +112,7 @@ namespace Acore::Impl return *this; } - void UpdateData(uint8 const* data, size_t len) + void UpdateData(uint8 const* data, std::size_t len) { int result = EVP_DigestUpdate(_ctx, data, len); ASSERT(result == 1); diff --git a/src/common/Cryptography/CryptoRandom.cpp b/src/common/Cryptography/CryptoRandom.cpp index 35d78f7444..c44f73eab5 100644 --- a/src/common/Cryptography/CryptoRandom.cpp +++ b/src/common/Cryptography/CryptoRandom.cpp @@ -19,7 +19,7 @@ #include "Errors.h" #include <openssl/rand.h> -void Acore::Crypto::GetRandomBytes(uint8* buf, size_t len) +void Acore::Crypto::GetRandomBytes(uint8* buf, std::size_t len) { int result = RAND_bytes(buf, len); ASSERT(result == 1, "Not enough randomness in OpenSSL's entropy pool. What in the world are you running on?"); diff --git a/src/common/Cryptography/CryptoRandom.h b/src/common/Cryptography/CryptoRandom.h index 07f87df00d..7554735ad5 100644 --- a/src/common/Cryptography/CryptoRandom.h +++ b/src/common/Cryptography/CryptoRandom.h @@ -23,7 +23,7 @@ namespace Acore::Crypto { - AC_COMMON_API void GetRandomBytes(uint8* buf, size_t len); + AC_COMMON_API void GetRandomBytes(uint8* buf, std::size_t len); template <typename Container> void GetRandomBytes(Container& c) @@ -31,7 +31,7 @@ namespace Acore::Crypto GetRandomBytes(std::data(c), std::size(c)); } - template <size_t S> + template <std::size_t S> std::array<uint8, S> GetRandomBytes() { std::array<uint8, S> arr; diff --git a/src/common/Cryptography/HMAC.h b/src/common/Cryptography/HMAC.h index ebfc1e14ba..6830c6131f 100644 --- a/src/common/Cryptography/HMAC.h +++ b/src/common/Cryptography/HMAC.h @@ -29,15 +29,15 @@ class BigNumber; namespace Acore::Impl { - template <GenericHashImpl::HashCreator HashCreator, size_t DigestLength> + template <GenericHashImpl::HashCreator HashCreator, std::size_t DigestLength> class GenericHMAC { public: - static constexpr size_t DIGEST_LENGTH = DigestLength; + static constexpr std::size_t DIGEST_LENGTH = DigestLength; using Digest = std::array<uint8, DIGEST_LENGTH>; template <typename Container> - static Digest GetDigestOf(Container const& seed, uint8 const* data, size_t len) + static Digest GetDigestOf(Container const& seed, uint8 const* data, std::size_t len) { GenericHMAC hash(seed); hash.UpdateData(data, len); @@ -54,7 +54,7 @@ namespace Acore::Impl return hash.GetDigest(); } - GenericHMAC(uint8 const* seed, size_t len) : _ctx(GenericHashImpl::MakeCTX()), _key(EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, nullptr, seed, len)) + GenericHMAC(uint8 const* seed, std::size_t len) : _ctx(GenericHashImpl::MakeCTX()), _key(EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, nullptr, seed, len)) { int result = EVP_DigestSignInit(_ctx, nullptr, HashCreator(), nullptr, _key); ASSERT(result == 1); @@ -105,7 +105,7 @@ namespace Acore::Impl return *this; } - void UpdateData(uint8 const* data, size_t len) + void UpdateData(uint8 const* data, std::size_t len) { int result = EVP_DigestSignUpdate(_ctx, data, len); ASSERT(result == 1); @@ -120,7 +120,7 @@ namespace Acore::Impl void Finalize() { - size_t length = DIGEST_LENGTH; + std::size_t length = DIGEST_LENGTH; int result = EVP_DigestSignFinal(_ctx, _digest.data(), &length); ASSERT(result == 1); ASSERT(length == DIGEST_LENGTH); diff --git a/src/common/Cryptography/OpenSSLCrypto.cpp b/src/common/Cryptography/OpenSSLCrypto.cpp index 036a94c0e7..1a69a0c0f8 100644 --- a/src/common/Cryptography/OpenSSLCrypto.cpp +++ b/src/common/Cryptography/OpenSSLCrypto.cpp @@ -16,7 +16,6 @@ */ #include "OpenSSLCrypto.h" -#include "Errors.h" #include <openssl/crypto.h> // NOTE: this import is NEEDED (even though some IDEs report it as unused) #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010000fL diff --git a/src/common/Cryptography/SessionKeyGenerator.h b/src/common/Cryptography/SessionKeyGenerator.h index 43dca3f235..bafd9ce014 100644 --- a/src/common/Cryptography/SessionKeyGenerator.h +++ b/src/common/Cryptography/SessionKeyGenerator.h @@ -18,9 +18,6 @@ #ifndef AZEROTHCORE_SESSIONKEYGENERATOR_HPP #define AZEROTHCORE_SESSIONKEYGENERATOR_HPP -#include "CryptoHash.h" -#include <cstring> - template <typename Hash> class SessionKeyGenerator { @@ -30,8 +27,8 @@ public: o0it(o0.begin()) { uint8 const* data = std::data(buf); - size_t const len = std::size(buf); - size_t const halflen = (len / 2); + std::size_t const len = std::size(buf); + std::size_t const halflen = (len / 2); o1 = Hash::GetDigestOf(data, halflen); o2 = Hash::GetDigestOf(data + halflen, len - halflen); diff --git a/src/common/Cryptography/TOTP.h b/src/common/Cryptography/TOTP.h index ddcaf75734..56ddccb6be 100644 --- a/src/common/Cryptography/TOTP.h +++ b/src/common/Cryptography/TOTP.h @@ -26,7 +26,7 @@ namespace Acore::Crypto { struct AC_COMMON_API TOTP { - static constexpr size_t RECOMMENDED_SECRET_LENGTH = 20; + static constexpr std::size_t RECOMMENDED_SECRET_LENGTH = 20; using Secret = std::vector<uint8>; static uint32 GenerateToken(Secret const& key, time_t timestamp); diff --git a/src/common/DataStores/DBCFileLoader.cpp b/src/common/DataStores/DBCFileLoader.cpp index 80bb213b57..dfabe1630d 100644 --- a/src/common/DataStores/DBCFileLoader.cpp +++ b/src/common/DataStores/DBCFileLoader.cpp @@ -120,7 +120,7 @@ DBCFileLoader::~DBCFileLoader() delete[] fieldsOffset; } -DBCFileLoader::Record DBCFileLoader::getRecord(size_t id) +DBCFileLoader::Record DBCFileLoader::getRecord(std::size_t id) { ASSERT(data); return Record(*this, data + id * recordSize); diff --git a/src/common/DataStores/DBCFileLoader.h b/src/common/DataStores/DBCFileLoader.h index c6781d40fa..ffe52e9a03 100644 --- a/src/common/DataStores/DBCFileLoader.h +++ b/src/common/DataStores/DBCFileLoader.h @@ -46,7 +46,7 @@ public: class Record { public: - [[nodiscard]] float getFloat(size_t field) const + [[nodiscard]] float getFloat(std::size_t field) const { ASSERT(field < file.fieldCount); float val = *reinterpret_cast<float*>(offset + file.GetOffset(field)); @@ -54,7 +54,7 @@ public: return val; } - [[nodiscard]] uint32 getUInt(size_t field) const + [[nodiscard]] uint32 getUInt(std::size_t field) const { ASSERT(field < file.fieldCount); uint32 val = *reinterpret_cast<uint32*>(offset + file.GetOffset(field)); @@ -62,16 +62,16 @@ public: return val; } - [[nodiscard]] uint8 getUInt8(size_t field) const + [[nodiscard]] uint8 getUInt8(std::size_t field) const { ASSERT(field < file.fieldCount); return *reinterpret_cast<uint8*>(offset + file.GetOffset(field)); } - [[nodiscard]] const char* getString(size_t field) const + [[nodiscard]] const char* getString(std::size_t field) const { ASSERT(field < file.fieldCount); - size_t stringOffset = getUInt(field); + std::size_t stringOffset = getUInt(field); ASSERT(stringOffset < file.stringSize); return reinterpret_cast<char*>(file.stringTable + stringOffset); } @@ -85,12 +85,12 @@ public: }; // Get record by id - Record getRecord(size_t id); + Record getRecord(std::size_t id); [[nodiscard]] uint32 GetNumRows() const { return recordCount; } [[nodiscard]] uint32 GetRowSize() const { return recordSize; } [[nodiscard]] uint32 GetCols() const { return fieldCount; } - [[nodiscard]] uint32 GetOffset(size_t id) const { return (fieldsOffset != nullptr && id < fieldCount) ? fieldsOffset[id] : 0; } + [[nodiscard]] uint32 GetOffset(std::size_t id) const { return (fieldsOffset != nullptr && id < fieldCount) ? fieldsOffset[id] : 0; } [[nodiscard]] bool IsLoaded() const { return data != nullptr; } char* AutoProduceData(char const* fmt, uint32& count, char**& indexTable); char* AutoProduceStrings(char const* fmt, char* dataTable); diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp index be56630025..57ba80cae7 100644 --- a/src/common/Debugging/WheatyExceptionReport.cpp +++ b/src/common/Debugging/WheatyExceptionReport.cpp @@ -260,13 +260,13 @@ BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxco return TRUE; } -template<size_t size> +template<std::size_t size> void ToTchar(wchar_t const* src, TCHAR (&dst)[size], std::true_type) { wcstombs_s(nullptr, dst, src, size); } -template<size_t size> +template<std::size_t size> void ToTchar(wchar_t const* src, TCHAR (&dst)[size], std::false_type) { wcscpy_s(dst, src); @@ -1455,8 +1455,8 @@ void WheatyExceptionReport::FormatOutputValue(char* pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, - size_t bufferSize, - size_t countOverride) + std::size_t bufferSize, + std::size_t countOverride) { __try { @@ -1677,7 +1677,7 @@ void WheatyExceptionReport::PrintSymbolDetail() } // Add appropriate indentation level (since this routine is recursive) - for (size_t i = 0; i < symbolDetails.size(); i++) + for (std::size_t i = 0; i < symbolDetails.size(); i++) { Log(_T("\t")); } diff --git a/src/common/Debugging/WheatyExceptionReport.h b/src/common/Debugging/WheatyExceptionReport.h index 3d6fb27575..94e91e8699 100644 --- a/src/common/Debugging/WheatyExceptionReport.h +++ b/src/common/Debugging/WheatyExceptionReport.h @@ -164,7 +164,7 @@ private: static void DumpTypeIndex(DWORD64, DWORD, DWORD_PTR, bool&, char const*, char*, bool, bool); - static void FormatOutputValue(char* pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, size_t bufferSize, size_t countOverride = 0); + static void FormatOutputValue(char* pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, std::size_t bufferSize, std::size_t countOverride = 0); static BasicType GetBasicType(DWORD typeIndex, DWORD64 modBase); static DWORD_PTR DereferenceUnsafePointer(DWORD_PTR address); diff --git a/src/common/Define.h b/src/common/Define.h index 1da537e411..09cd43544f 100644 --- a/src/common/Define.h +++ b/src/common/Define.h @@ -21,7 +21,6 @@ #include "CompilerDefs.h" #include <cinttypes> #include <climits> -#include <cstddef> #define ACORE_LITTLEENDIAN 0 #define ACORE_BIGENDIAN 1 diff --git a/src/common/Dynamic/FactoryHolder.h b/src/common/Dynamic/FactoryHolder.h index 093f6e4f3c..245bd02825 100644 --- a/src/common/Dynamic/FactoryHolder.h +++ b/src/common/Dynamic/FactoryHolder.h @@ -20,7 +20,6 @@ #include "Define.h" #include "ObjectRegistry.h" -#include "TypeList.h" /** FactoryHolder holds a factory object of a specific type */ diff --git a/src/common/Dynamic/ObjectRegistry.h b/src/common/Dynamic/ObjectRegistry.h index fe8c64dd74..31adcd8f16 100644 --- a/src/common/Dynamic/ObjectRegistry.h +++ b/src/common/Dynamic/ObjectRegistry.h @@ -18,12 +18,9 @@ #ifndef ACORE_OBJECTREGISTRY_H #define ACORE_OBJECTREGISTRY_H -#include "Define.h" #include <map> #include <memory> #include <string> -#include <unordered_map> -#include <vector> /** ObjectRegistry holds all registry item of the same type */ diff --git a/src/common/Dynamic/TypeContainer.h b/src/common/Dynamic/TypeContainer.h index 2a69bd61e9..7e8ef91bca 100644 --- a/src/common/Dynamic/TypeContainer.h +++ b/src/common/Dynamic/TypeContainer.h @@ -23,12 +23,10 @@ * types of object at the same time. */ -#include "Define.h" #include "Dynamic/TypeList.h" #include "GridRefMgr.h" #include <map> #include <unordered_map> -#include <vector> /* * @class ContainerMapList is a mulit-type container for map elements @@ -102,7 +100,7 @@ template<class OBJECT_TYPES> class TypeMapContainer { public: - template<class SPECIFIC_TYPE> [[nodiscard]] size_t Count() const { return Acore::Count(i_elements, (SPECIFIC_TYPE*)nullptr); } + template<class SPECIFIC_TYPE> [[nodiscard]] std::size_t Count() const { return Acore::Count(i_elements, (SPECIFIC_TYPE*)nullptr); } /// inserts a specific object into the container template<class SPECIFIC_TYPE> diff --git a/src/common/Dynamic/TypeContainerFunctions.h b/src/common/Dynamic/TypeContainerFunctions.h index e34d914bea..12094a4909 100644 --- a/src/common/Dynamic/TypeContainerFunctions.h +++ b/src/common/Dynamic/TypeContainerFunctions.h @@ -24,10 +24,7 @@ * to access or mutate the container. */ -#include "Define.h" #include "Dynamic/TypeList.h" -#include <map> -#include <unordered_map> namespace Acore { @@ -159,31 +156,31 @@ namespace Acore /* ContainerMapList Helpers */ // count functions template<class SPECIFIC_TYPE> - size_t Count(const ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* /*fake*/) + std::size_t Count(const ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* /*fake*/) { return elements._element.getSize(); } template<class SPECIFIC_TYPE> - size_t Count(const ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*fake*/) + std::size_t Count(const ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*fake*/) { return 0; } template<class SPECIFIC_TYPE, class T> - size_t Count(const ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*fake*/) + std::size_t Count(const ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*fake*/) { return 0; } template<class SPECIFIC_TYPE, class T> - size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T>>& elements, SPECIFIC_TYPE* fake) + std::size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T>>& elements, SPECIFIC_TYPE* fake) { return Count(elements._elements, fake); } template<class SPECIFIC_TYPE, class H, class T> - size_t Count(const ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* fake) + std::size_t Count(const ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* fake) { return Count(elements._TailElements, fake); } diff --git a/src/common/Dynamic/TypeContainerFunctionsPtr.h b/src/common/Dynamic/TypeContainerFunctionsPtr.h index 836aef7697..37be105cee 100644 --- a/src/common/Dynamic/TypeContainerFunctionsPtr.h +++ b/src/common/Dynamic/TypeContainerFunctionsPtr.h @@ -32,27 +32,27 @@ namespace Acore { /* ContainerMapList Helpers */ // count functions - // template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<SPECIFIC_TYPE> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) + // template<class SPECIFIC_TYPE> std::size_t Count(const ContainerMapList<SPECIFIC_TYPE> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) // { // return elements._element.size(); // }; // - // template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<TypeNull> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) + // template<class SPECIFIC_TYPE> std::size_t Count(const ContainerMapList<TypeNull> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) // { // return 0; // } // - // template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<T> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) + // template<class SPECIFIC_TYPE, class T> std::size_t Count(const ContainerMapList<T> &elements, CountedPtr<SPECIFIC_TYPE>* /*fake*/) // { // return 0; // } // - // template<class SPECIFIC_TYPE, class T> size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T> >&elements, SPECIFIC_TYPE* fake) + // template<class SPECIFIC_TYPE, class T> std::size_t Count(const ContainerMapList<TypeList<SPECIFIC_TYPE, T> >&elements, SPECIFIC_TYPE* fake) // { // return Count(elements._elements, fake); // } // - // template<class SPECIFIC_TYPE, class H, class T> size_t Count(const ContainerMapList<TypeList<H, T> >&elements, SPECIFIC_TYPE* fake) + // template<class SPECIFIC_TYPE, class H, class T> std::size_t Count(const ContainerMapList<TypeList<H, T> >&elements, SPECIFIC_TYPE* fake) // { // return Count(elements._TailElements, fake); // } diff --git a/src/common/Dynamic/TypeContainerVisitor.h b/src/common/Dynamic/TypeContainerVisitor.h index cab848b4be..1553d918af 100644 --- a/src/common/Dynamic/TypeContainerVisitor.h +++ b/src/common/Dynamic/TypeContainerVisitor.h @@ -24,7 +24,6 @@ * to overload its types as a visit method is called. */ -#include "Define.h" #include "Dynamic/TypeContainer.h" // forward declaration diff --git a/src/common/Logging/Appender.h b/src/common/Logging/Appender.h index 23f2d47f65..0d5e028019 100644 --- a/src/common/Logging/Appender.h +++ b/src/common/Logging/Appender.h @@ -22,7 +22,6 @@ #include "LogCommon.h" #include <stdexcept> #include <string> -#include <vector> struct LogMessage; diff --git a/src/common/Logging/AppenderConsole.h b/src/common/Logging/AppenderConsole.h index 9da2a6ec5b..d60553523a 100644 --- a/src/common/Logging/AppenderConsole.h +++ b/src/common/Logging/AppenderConsole.h @@ -19,6 +19,7 @@ #define APPENDERCONSOLE_H #include "Appender.h" +#include <vector> // EnumUtils: DESCRIBE THIS enum ColorTypes diff --git a/src/common/Logging/AppenderFile.cpp b/src/common/Logging/AppenderFile.cpp index 3357b2cf30..81b84cb985 100644 --- a/src/common/Logging/AppenderFile.cpp +++ b/src/common/Logging/AppenderFile.cpp @@ -44,7 +44,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, Ap if (flags & APPENDER_FLAGS_USE_TIMESTAMP) { - size_t dot_pos = _fileName.find_last_of('.'); + std::size_t dot_pos = _fileName.find_last_of('.'); if (dot_pos != std::string::npos) { _fileName.insert(dot_pos, sLog->GetLogsTimestamp()); diff --git a/src/common/Logging/AppenderFile.h b/src/common/Logging/AppenderFile.h index cb1d0424fc..38b21065a8 100644 --- a/src/common/Logging/AppenderFile.h +++ b/src/common/Logging/AppenderFile.h @@ -20,6 +20,7 @@ #include "Appender.h" #include <atomic> +#include <vector> class AppenderFile : public Appender { diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index 6fd65216ca..37809458b8 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -73,7 +73,7 @@ void Log::CreateAppenderFromConfig(std::string const& appenderName) std::vector<std::string_view> tokens = Acore::Tokenize(options, ',', true); - size_t const size = tokens.size(); + std::size_t const size = tokens.size(); std::string name = appenderName.substr(9); if (size < 2) @@ -265,7 +265,7 @@ Logger const* Log::GetLoggerByType(std::string const& type) const } std::string parentLogger = LOGGER_ROOT; - size_t found = type.find_last_of('.'); + std::size_t found = type.find_last_of('.'); if (found != std::string::npos) { parentLogger = type.substr(0, found); diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index f80869399c..f60bb03678 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -21,7 +21,6 @@ #include "Define.h" #include "LogCommon.h" #include "StringFormat.h" -#include <memory> #include <unordered_map> #include <vector> diff --git a/src/common/Logging/LogOperation.h b/src/common/Logging/LogOperation.h index 77d403d5c2..9c24ca5b7a 100644 --- a/src/common/Logging/LogOperation.h +++ b/src/common/Logging/LogOperation.h @@ -18,7 +18,6 @@ #ifndef LOGOPERATION_H #define LOGOPERATION_H -#include "Define.h" #include <memory> class Logger; diff --git a/src/common/Logging/enuminfo_AppenderConsole.cpp b/src/common/Logging/enuminfo_AppenderConsole.cpp index c747a1befa..28031a58b9 100644 --- a/src/common/Logging/enuminfo_AppenderConsole.cpp +++ b/src/common/Logging/enuminfo_AppenderConsole.cpp @@ -51,10 +51,10 @@ AC_API_EXPORT EnumText EnumUtils<ColorTypes>::ToString(ColorTypes value) } template <> -AC_API_EXPORT size_t EnumUtils<ColorTypes>::Count() { return 15; } +AC_API_EXPORT std::size_t EnumUtils<ColorTypes>::Count() { return 15; } template <> -AC_API_EXPORT ColorTypes EnumUtils<ColorTypes>::FromIndex(size_t index) +AC_API_EXPORT ColorTypes EnumUtils<ColorTypes>::FromIndex(std::size_t index) { switch (index) { @@ -78,7 +78,7 @@ AC_API_EXPORT ColorTypes EnumUtils<ColorTypes>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<ColorTypes>::ToIndex(ColorTypes value) +AC_API_EXPORT std::size_t EnumUtils<ColorTypes>::ToIndex(ColorTypes value) { switch (value) { diff --git a/src/common/Logging/enuminfo_LogCommon.cpp b/src/common/Logging/enuminfo_LogCommon.cpp index 2e42655635..e06d5fc26c 100644 --- a/src/common/Logging/enuminfo_LogCommon.cpp +++ b/src/common/Logging/enuminfo_LogCommon.cpp @@ -43,10 +43,10 @@ AC_API_EXPORT EnumText EnumUtils<LogLevel>::ToString(LogLevel value) } template <> -AC_API_EXPORT size_t EnumUtils<LogLevel>::Count() { return 7; } +AC_API_EXPORT std::size_t EnumUtils<LogLevel>::Count() { return 7; } template <> -AC_API_EXPORT LogLevel EnumUtils<LogLevel>::FromIndex(size_t index) +AC_API_EXPORT LogLevel EnumUtils<LogLevel>::FromIndex(std::size_t index) { switch (index) { @@ -62,7 +62,7 @@ AC_API_EXPORT LogLevel EnumUtils<LogLevel>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<LogLevel>::ToIndex(LogLevel value) +AC_API_EXPORT std::size_t EnumUtils<LogLevel>::ToIndex(LogLevel value) { switch (value) { @@ -94,10 +94,10 @@ AC_API_EXPORT EnumText EnumUtils<AppenderType>::ToString(AppenderType value) } template <> -AC_API_EXPORT size_t EnumUtils<AppenderType>::Count() { return 4; } +AC_API_EXPORT std::size_t EnumUtils<AppenderType>::Count() { return 4; } template <> -AC_API_EXPORT AppenderType EnumUtils<AppenderType>::FromIndex(size_t index) +AC_API_EXPORT AppenderType EnumUtils<AppenderType>::FromIndex(std::size_t index) { switch (index) { @@ -110,7 +110,7 @@ AC_API_EXPORT AppenderType EnumUtils<AppenderType>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<AppenderType>::ToIndex(AppenderType value) +AC_API_EXPORT std::size_t EnumUtils<AppenderType>::ToIndex(AppenderType value) { switch (value) { @@ -141,10 +141,10 @@ AC_API_EXPORT EnumText EnumUtils<AppenderFlags>::ToString(AppenderFlags value) } template <> -AC_API_EXPORT size_t EnumUtils<AppenderFlags>::Count() { return 6; } +AC_API_EXPORT std::size_t EnumUtils<AppenderFlags>::Count() { return 6; } template <> -AC_API_EXPORT AppenderFlags EnumUtils<AppenderFlags>::FromIndex(size_t index) +AC_API_EXPORT AppenderFlags EnumUtils<AppenderFlags>::FromIndex(std::size_t index) { switch (index) { @@ -159,7 +159,7 @@ AC_API_EXPORT AppenderFlags EnumUtils<AppenderFlags>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<AppenderFlags>::ToIndex(AppenderFlags value) +AC_API_EXPORT std::size_t EnumUtils<AppenderFlags>::ToIndex(AppenderFlags value) { switch (value) { diff --git a/src/common/Metric/Metric.h b/src/common/Metric/Metric.h index ed841a1e9b..fda4048d6a 100644 --- a/src/common/Metric/Metric.h +++ b/src/common/Metric/Metric.h @@ -22,11 +22,9 @@ #include "Duration.h" #include "MPSCQueue.h" #include <functional> -#include <iosfwd> #include <memory> #include <string> #include <unordered_map> -#include <utility> #include <vector> namespace Acore::Asio diff --git a/src/common/Threading/MPSCQueue.h b/src/common/Threading/MPSCQueue.h index ce26db40b8..15176178b0 100644 --- a/src/common/Threading/MPSCQueue.h +++ b/src/common/Threading/MPSCQueue.h @@ -19,8 +19,6 @@ #define MPSCQueue_h__ #include <atomic> -#include <memory> -#include <utility> namespace Acore::Impl { diff --git a/src/common/Threading/PCQueue.h b/src/common/Threading/PCQueue.h index 6484053655..57f3b08efb 100644 --- a/src/common/Threading/PCQueue.h +++ b/src/common/Threading/PCQueue.h @@ -18,11 +18,8 @@ #ifndef _PCQ_H #define _PCQ_H -#include <atomic> #include <condition_variable> -#include <mutex> #include <queue> -#include <type_traits> template <typename T> class ProducerConsumerQueue @@ -51,7 +48,7 @@ public: return _queue.empty(); } - [[nodiscard]] size_t Size() const + [[nodiscard]] std::size_t Size() const { return _queue.size(); } diff --git a/src/common/Threading/ThreadingModel.h b/src/common/Threading/ThreadingModel.h index 69d4f5b8ed..a23884df39 100644 --- a/src/common/Threading/ThreadingModel.h +++ b/src/common/Threading/ThreadingModel.h @@ -23,8 +23,6 @@ * */ -#include "Define.h" - namespace Acore { template<typename MUTEX> diff --git a/src/common/Utilities/AsyncCallbackProcessor.h b/src/common/Utilities/AsyncCallbackProcessor.h index 54b981cbcb..68566809a6 100644 --- a/src/common/Utilities/AsyncCallbackProcessor.h +++ b/src/common/Utilities/AsyncCallbackProcessor.h @@ -18,7 +18,6 @@ #ifndef AsyncCallbackProcessor_h__ #define AsyncCallbackProcessor_h__ -#include "Define.h" #include <algorithm> #include <vector> diff --git a/src/common/Utilities/ByteConverter.h b/src/common/Utilities/ByteConverter.h index 4a96d773cb..ff0818bd6b 100644 --- a/src/common/Utilities/ByteConverter.h +++ b/src/common/Utilities/ByteConverter.h @@ -27,7 +27,7 @@ namespace ByteConverter { - template<size_t T> + template<std::size_t T> inline void convert(char* val) { std::swap(*val, *(val + T - 1)); diff --git a/src/common/Utilities/CircularBuffer.h b/src/common/Utilities/CircularBuffer.h index 898ab1a11e..4c23099c9e 100644 --- a/src/common/Utilities/CircularBuffer.h +++ b/src/common/Utilities/CircularBuffer.h @@ -17,7 +17,7 @@ template <typename T> class CircularBuffer { public: - explicit CircularBuffer(size_t size) : + explicit CircularBuffer(std::size_t size) : buf_(std::unique_ptr<T[]>(new T[size])), max_size_(size) { @@ -52,14 +52,14 @@ public: return full_; } - [[nodiscard]] size_t capacity() const + [[nodiscard]] std::size_t capacity() const { return max_size_; } - [[nodiscard]] size_t size() const + [[nodiscard]] std::size_t size() const { - size_t size = max_size_; + std::size_t size = max_size_; if (!full_) { @@ -95,9 +95,9 @@ public: private: std::mutex mutex_; std::unique_ptr<T[]> buf_; - size_t head_ = 0; - size_t tail_ = 0; - const size_t max_size_; + std::size_t head_ = 0; + std::size_t tail_ = 0; + const std::size_t max_size_; bool full_ = false; }; #endif diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h index c77a48be7e..3a5c3b1809 100644 --- a/src/common/Utilities/Containers.h +++ b/src/common/Utilities/Containers.h @@ -23,8 +23,6 @@ #include <algorithm> #include <iterator> #include <stdexcept> -#include <type_traits> -#include <utility> #include <vector> namespace Acore @@ -51,13 +49,13 @@ namespace Acore using reference = T&; using difference_type = std::ptrdiff_t; - CheckedBufferOutputIterator(T* buf, size_t n) : _buf(buf), _end(buf + n) {} + CheckedBufferOutputIterator(T* buf, std::size_t n) : _buf(buf), _end(buf + n) {} T& operator*() const { check(); return *_buf; } CheckedBufferOutputIterator& operator++() { check(); ++_buf; return *this; } CheckedBufferOutputIterator operator++(int) { CheckedBufferOutputIterator v = *this; operator++(); return v; } - [[nodiscard]] size_t remaining() const { return (_end - _buf); } + [[nodiscard]] std::size_t remaining() const { return (_end - _buf); } private: T* _buf; diff --git a/src/common/Utilities/EventProcessor.h b/src/common/Utilities/EventProcessor.h index 0ebd48077b..3e7896bb33 100644 --- a/src/common/Utilities/EventProcessor.h +++ b/src/common/Utilities/EventProcessor.h @@ -22,7 +22,6 @@ #include "Duration.h" #include "Random.h" #include <map> -#include <type_traits> class EventProcessor; diff --git a/src/common/Utilities/Geometry.h b/src/common/Utilities/Geometry.h index f5912c8381..75affe53bc 100644 --- a/src/common/Utilities/Geometry.h +++ b/src/common/Utilities/Geometry.h @@ -24,9 +24,7 @@ #ifndef _ACORE_GEOMETRY_H #define _ACORE_GEOMETRY_H -#include "Define.h" #include <cstdlib> -#include <iostream> #include <math.h> [[nodiscard]] inline float getAngle(float startX, float startY, float destX, float destY) diff --git a/src/common/Utilities/IteratorPair.h b/src/common/Utilities/IteratorPair.h index c1e512c28b..385c77a864 100644 --- a/src/common/Utilities/IteratorPair.h +++ b/src/common/Utilities/IteratorPair.h @@ -18,7 +18,6 @@ #ifndef IteratorPair_h__ #define IteratorPair_h__ -#include "Define.h" #include <utility> namespace Acore diff --git a/src/common/Utilities/MathUtil.h b/src/common/Utilities/MathUtil.h index fad8317c30..f1df43e7db 100644 --- a/src/common/Utilities/MathUtil.h +++ b/src/common/Utilities/MathUtil.h @@ -58,7 +58,7 @@ inline T mean(Container&& c) template <typename T> inline T median(std::vector<T> a) { - size_t n = a.size(); + std::size_t n = a.size(); // If size of the arr[] is even if (n % 2 == 0) { diff --git a/src/common/Utilities/Physics.h b/src/common/Utilities/Physics.h index 8aff22f683..3f4d93a67d 100644 --- a/src/common/Utilities/Physics.h +++ b/src/common/Utilities/Physics.h @@ -25,9 +25,6 @@ #define _ACORE_PHYSICS_H #include "Geometry.h" -#include <cmath> -#include <cstdlib> -#include <iostream> using namespace std; diff --git a/src/common/Utilities/Random.cpp b/src/common/Utilities/Random.cpp index f80e023079..40090caa15 100644 --- a/src/common/Utilities/Random.cpp +++ b/src/common/Utilities/Random.cpp @@ -86,7 +86,7 @@ double rand_chance() return urd(engine); } -uint32 urandweighted(size_t count, double const* chances) +uint32 urandweighted(std::size_t count, double const* chances) { std::discrete_distribution<uint32> dd(chances, chances + count); return dd(engine); diff --git a/src/common/Utilities/Random.h b/src/common/Utilities/Random.h index 9b1867e281..07bc91d3ae 100644 --- a/src/common/Utilities/Random.h +++ b/src/common/Utilities/Random.h @@ -47,7 +47,7 @@ AC_COMMON_API double rand_norm(); AC_COMMON_API double rand_chance(); /* Return a random number in the range 0..count (exclusive) with each value having a different chance of happening */ -AC_COMMON_API uint32 urandweighted(size_t count, double const* chances); +AC_COMMON_API uint32 urandweighted(std::size_t count, double const* chances); /* Return true if a random roll fits in the specified chance (range 0-100). */ inline bool roll_chance_f(float chance) diff --git a/src/common/Utilities/SFMTRand.cpp b/src/common/Utilities/SFMTRand.cpp index fccd41aab8..c109924dbb 100644 --- a/src/common/Utilities/SFMTRand.cpp +++ b/src/common/Utilities/SFMTRand.cpp @@ -26,7 +26,7 @@ #include <mm_malloc.h> #elif defined(__GNUC__) static __inline__ void *__attribute__((__always_inline__, __nodebug__, __malloc__)) - _mm_malloc(size_t __size, size_t __align) + _mm_malloc(std::size_t __size, std::size_t __align) { if (__align == 1) { @@ -78,7 +78,7 @@ uint32 SFMTRand::RandomUInt32() // Output random bits return sfmt_genrand_uint32(&_state); } -void* SFMTRand::operator new(size_t size, std::nothrow_t const&) +void* SFMTRand::operator new(std::size_t size, std::nothrow_t const&) { return _mm_malloc(size, 16); } @@ -88,7 +88,7 @@ void SFMTRand::operator delete(void* ptr, std::nothrow_t const&) _mm_free(ptr); } -void* SFMTRand::operator new(size_t size) +void* SFMTRand::operator new(std::size_t size) { return _mm_malloc(size, 16); } @@ -98,7 +98,7 @@ void SFMTRand::operator delete(void* ptr) _mm_free(ptr); } -void* SFMTRand::operator new[](size_t size, std::nothrow_t const&) +void* SFMTRand::operator new[](std::size_t size, std::nothrow_t const&) { return _mm_malloc(size, 16); } @@ -108,7 +108,7 @@ void SFMTRand::operator delete[](void* ptr, std::nothrow_t const&) _mm_free(ptr); } -void* SFMTRand::operator new[](size_t size) +void* SFMTRand::operator new[](std::size_t size) { return _mm_malloc(size, 16); } diff --git a/src/common/Utilities/SFMTRand.h b/src/common/Utilities/SFMTRand.h index 30981b47df..e24cfe198d 100644 --- a/src/common/Utilities/SFMTRand.h +++ b/src/common/Utilities/SFMTRand.h @@ -30,13 +30,13 @@ class SFMTRand public: SFMTRand(); uint32 RandomUInt32(); // Output random bits - void* operator new(size_t size, std::nothrow_t const&); + void* operator new(std::size_t size, std::nothrow_t const&); void operator delete(void* ptr, std::nothrow_t const&); - void* operator new(size_t size); + void* operator new(std::size_t size); void operator delete(void* ptr); - void* operator new[](size_t size, std::nothrow_t const&); + void* operator new[](std::size_t size, std::nothrow_t const&); void operator delete[](void* ptr, std::nothrow_t const&); - void* operator new[](size_t size); + void* operator new[](std::size_t size); void operator delete[](void* ptr); private: sfmt_t _state; diff --git a/src/common/Utilities/SmartEnum.h b/src/common/Utilities/SmartEnum.h index e6e0be2572..fd00b83625 100644 --- a/src/common/Utilities/SmartEnum.h +++ b/src/common/Utilities/SmartEnum.h @@ -37,10 +37,10 @@ namespace Acore::Impl::EnumUtilsImpl template <typename Enum> struct EnumUtils { - static size_t Count(); + static std::size_t Count(); static EnumText ToString(Enum value); - static Enum FromIndex(size_t index); - static size_t ToIndex(Enum index); + static Enum FromIndex(std::size_t index); + static std::size_t ToIndex(Enum index); }; } @@ -48,11 +48,11 @@ class EnumUtils { public: template <typename Enum> - static size_t Count() { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::Count(); } + static std::size_t Count() { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::Count(); } template <typename Enum> static EnumText ToString(Enum value) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToString(value); } template <typename Enum> - static Enum FromIndex(size_t index) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::FromIndex(index); } + static Enum FromIndex(std::size_t index) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::FromIndex(index); } template <typename Enum> static uint32 ToIndex(Enum value) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);} @@ -84,7 +84,7 @@ public: using difference_type = std::ptrdiff_t; Iterator() : _index(EnumUtils::Count<Enum>()) {} - explicit Iterator(size_t index) : _index(index) { } + explicit Iterator(std::size_t index) : _index(index) { } bool operator==(const Iterator& other) const { return other._index == _index; } bool operator!=(const Iterator& other) const { return !operator==(other); } diff --git a/src/common/Utilities/StartProcess.h b/src/common/Utilities/StartProcess.h index 6b564cb9e1..6de13d1be9 100644 --- a/src/common/Utilities/StartProcess.h +++ b/src/common/Utilities/StartProcess.h @@ -20,7 +20,6 @@ #include "Define.h" #include <future> -#include <memory> #include <string> #include <vector> diff --git a/src/common/Utilities/StringConvert.h b/src/common/Utilities/StringConvert.h index bd02cf3ea2..4f51b9746e 100644 --- a/src/common/Utilities/StringConvert.h +++ b/src/common/Utilities/StringConvert.h @@ -219,7 +219,7 @@ namespace Acore::Impl::StringConvertImpl } tmp.append(str); - size_t n; + std::size_t n; T val = static_cast<T>(std::stold(tmp, &n)); if (n != tmp.length()) { diff --git a/src/common/Utilities/TaskScheduler.cpp b/src/common/Utilities/TaskScheduler.cpp index 1d0bf89e6e..1e4e0222da 100644 --- a/src/common/Utilities/TaskScheduler.cpp +++ b/src/common/Utilities/TaskScheduler.cpp @@ -31,7 +31,7 @@ TaskScheduler& TaskScheduler::Update(success_t const& callback) return *this; } -TaskScheduler& TaskScheduler::Update(size_t const milliseconds, success_t const& callback) +TaskScheduler& TaskScheduler::Update(std::size_t const milliseconds, success_t const& callback) { return Update(std::chrono::milliseconds(milliseconds), callback); } diff --git a/src/common/Utilities/TaskScheduler.h b/src/common/Utilities/TaskScheduler.h index a256be6801..145489e086 100644 --- a/src/common/Utilities/TaskScheduler.h +++ b/src/common/Utilities/TaskScheduler.h @@ -19,14 +19,11 @@ #define _TASK_SCHEDULER_H_ #include "Util.h" -#include <algorithm> #include <chrono> #include <functional> -#include <memory> #include <optional> #include <queue> #include <set> -#include <utility> #include <vector> class TaskContext; @@ -209,7 +206,7 @@ public: /// Update the scheduler with a difftime in ms. /// Calls the optional callback on successfully finish. - TaskScheduler& Update(size_t const milliseconds, success_t const& callback = EmptyCallback); + TaskScheduler& Update(std::size_t const milliseconds, success_t const& callback = EmptyCallback); /// Update the scheduler with a difftime. /// Calls the optional callback on successfully finish. diff --git a/src/common/Utilities/Tokenize.cpp b/src/common/Utilities/Tokenize.cpp index 98ba213a61..3ceb57f087 100644 --- a/src/common/Utilities/Tokenize.cpp +++ b/src/common/Utilities/Tokenize.cpp @@ -21,8 +21,8 @@ std::vector<std::string_view> Acore::Tokenize(std::string_view str, char sep, bo { std::vector<std::string_view> tokens; - size_t start = 0; - for (size_t end = str.find(sep); end != std::string_view::npos; end = str.find(sep, start)) + std::size_t start = 0; + for (std::size_t end = str.find(sep); end != std::string_view::npos; end = str.find(sep, start)) { if (keepEmpty || (start < end)) { diff --git a/src/common/Utilities/Tokenize.h b/src/common/Utilities/Tokenize.h index a871c83be9..6ee20ca53e 100644 --- a/src/common/Utilities/Tokenize.h +++ b/src/common/Utilities/Tokenize.h @@ -18,7 +18,6 @@ #ifndef _ACORE_TOKENIZE_H_ #define _ACORE_TOKENIZE_H_ -#include "Common.h" #include <string_view> #include <vector> diff --git a/src/common/Utilities/Tuples.h b/src/common/Utilities/Tuples.h index 886faac51d..f648e20e64 100644 --- a/src/common/Utilities/Tuples.h +++ b/src/common/Utilities/Tuples.h @@ -48,7 +48,7 @@ namespace Acore namespace Impl { - template <class T, class Tuple, size_t... I> + template <class T, class Tuple, std::size_t... I> T* new_from_tuple(Tuple&& args, std::index_sequence<I...>) { return new T(std::get<I>(std::forward<Tuple>(args))...); diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index ee397dd4dd..0652e56673 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -33,10 +33,10 @@ void stripLineInvisibleChars(std::string& str) { static std::string const invChars = " \t\7\n"; - size_t wpos = 0; + std::size_t wpos = 0; bool space = false; - for (size_t pos = 0; pos < str.size(); ++pos) + for (std::size_t pos = 0; pos < str.size(); ++pos) { if (invChars.find(str[pos]) != std::string::npos) { @@ -242,7 +242,7 @@ uint32 GetPID() return uint32(pid); } -size_t utf8length(std::string& utf8str) +std::size_t utf8length(std::string& utf8str) { try { @@ -255,11 +255,11 @@ size_t utf8length(std::string& utf8str) } } -void utf8truncate(std::string& utf8str, size_t len) +void utf8truncate(std::string& utf8str, std::size_t len) { try { - size_t wlen = utf8::distance(utf8str.c_str(), utf8str.c_str() + utf8str.size()); + std::size_t wlen = utf8::distance(utf8str.c_str(), utf8str.c_str() + utf8str.size()); if (wlen <= len) { return; @@ -278,7 +278,7 @@ void utf8truncate(std::string& utf8str, size_t len) } } -bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) +bool Utf8toWStr(char const* utf8str, std::size_t csize, wchar_t* wstr, std::size_t& wsize) { try { @@ -330,7 +330,7 @@ bool Utf8toWStr(std::string_view utf8str, std::wstring& wstr) return true; } -bool WStrToUtf8(wchar_t const* wstr, size_t size, std::string& utf8str) +bool WStrToUtf8(wchar_t const* wstr, std::size_t size, std::string& utf8str) { try { @@ -512,14 +512,14 @@ void vutf8printf(FILE* out, const char* str, va_list* ap) char temp_buf[32 * 1024]; wchar_t wtemp_buf[32 * 1024]; - size_t temp_len = vsnprintf(temp_buf, 32 * 1024, str, *ap); + std::size_t temp_len = vsnprintf(temp_buf, 32 * 1024, str, *ap); //vsnprintf returns -1 if the buffer is too small - if (temp_len == size_t(-1)) + if (temp_len == std::size_t(-1)) { temp_len = 32 * 1024 - 1; } - size_t wtemp_len = 32 * 1024 - 1; + std::size_t wtemp_len = 32 * 1024 - 1; Utf8toWStr(temp_buf, temp_len, wtemp_buf, wtemp_len); CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], uint32(wtemp_len + 1)); @@ -542,7 +542,7 @@ bool Utf8ToUpperOnlyLatin(std::string& utf8String) return WStrToUtf8(wstr, utf8String); } -std::string Acore::Impl::ByteArrayToHexStr(uint8 const* bytes, size_t arrayLen, bool reverse /* = false */) +std::string Acore::Impl::ByteArrayToHexStr(uint8 const* bytes, std::size_t arrayLen, bool reverse /* = false */) { int32 init = 0; int32 end = arrayLen; @@ -566,7 +566,7 @@ std::string Acore::Impl::ByteArrayToHexStr(uint8 const* bytes, size_t arrayLen, return ss.str(); } -void Acore::Impl::HexStrToByteArray(std::string_view str, uint8* out, size_t outlen, bool reverse /*= false*/) +void Acore::Impl::HexStrToByteArray(std::string_view str, uint8* out, std::size_t outlen, bool reverse /*= false*/) { ASSERT(str.size() == (2 * outlen)); diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index ddc72c10d9..e5ced06991 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -85,9 +85,9 @@ inline T RoundToInterval(T& num, T floor, T ceil) AC_COMMON_API bool Utf8toWStr(std::string_view utf8str, std::wstring& wstr); // in wsize==max size of buffer, out wsize==real string size -AC_COMMON_API bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize); +AC_COMMON_API bool Utf8toWStr(char const* utf8str, std::size_t csize, wchar_t* wstr, std::size_t& wsize); -inline bool Utf8toWStr(std::string_view utf8str, wchar_t* wstr, size_t& wsize) +inline bool Utf8toWStr(std::string_view utf8str, wchar_t* wstr, std::size_t& wsize) { return Utf8toWStr(utf8str.data(), utf8str.size(), wstr, wsize); } @@ -95,11 +95,11 @@ inline bool Utf8toWStr(std::string_view utf8str, wchar_t* wstr, size_t& wsize) AC_COMMON_API bool WStrToUtf8(std::wstring_view wstr, std::string& utf8str); // size==real string size -AC_COMMON_API bool WStrToUtf8(wchar_t const* wstr, size_t size, std::string& utf8str); +AC_COMMON_API bool WStrToUtf8(wchar_t const* wstr, std::size_t size, std::string& utf8str); // set string to "" if invalid utf8 sequence -size_t utf8length(std::string& utf8str); -void utf8truncate(std::string& utf8str, size_t len); +std::size_t utf8length(std::string& utf8str); +void utf8truncate(std::string& utf8str, std::size_t len); inline bool isBasicLatinCharacter(wchar_t wchar) { @@ -373,8 +373,8 @@ uint32 GetPID(); namespace Acore::Impl { - AC_COMMON_API std::string ByteArrayToHexStr(uint8 const* bytes, size_t length, bool reverse = false); - AC_COMMON_API void HexStrToByteArray(std::string_view str, uint8* out, size_t outlen, bool reverse = false); + AC_COMMON_API std::string ByteArrayToHexStr(uint8 const* bytes, std::size_t length, bool reverse = false); + AC_COMMON_API void HexStrToByteArray(std::string_view str, uint8* out, std::size_t outlen, bool reverse = false); } template<typename Container> @@ -383,13 +383,13 @@ std::string ByteArrayToHexStr(Container const& c, bool reverse = false) return Acore::Impl::ByteArrayToHexStr(std::data(c), std::size(c), reverse); } -template<size_t Size> +template<std::size_t Size> void HexStrToByteArray(std::string_view str, std::array<uint8, Size>& buf, bool reverse = false) { Acore::Impl::HexStrToByteArray(str, buf.data(), Size, reverse); } -template<size_t Size> +template<std::size_t Size> std::array<uint8, Size> HexStrToByteArray(std::string_view str, bool reverse = false) { std::array<uint8, Size> arr; @@ -433,7 +433,7 @@ public: m_list.remove(t); return *this; } - size_t size() + std::size_t size() { return m_list.size(); } diff --git a/src/server/apps/authserver/Server/AuthSession.cpp b/src/server/apps/authserver/Server/AuthSession.cpp index 741e4724ec..bd9e0c61f1 100644 --- a/src/server/apps/authserver/Server/AuthSession.cpp +++ b/src/server/apps/authserver/Server/AuthSession.cpp @@ -751,7 +751,7 @@ void AuthSession::RealmListCallback(PreparedQueryResult result) // Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm) ByteBuffer pkt; - size_t RealmListSize = 0; + std::size_t RealmListSize = 0; for (auto const& [realmHandle, realm] : sRealmList->GetRealms()) { // don't work with realms which not compatible with the client diff --git a/src/server/apps/authserver/Server/AuthSession.h b/src/server/apps/authserver/Server/AuthSession.h index fe19cf8092..b85421327e 100644 --- a/src/server/apps/authserver/Server/AuthSession.h +++ b/src/server/apps/authserver/Server/AuthSession.h @@ -113,7 +113,7 @@ private: struct AuthHandler { AuthStatus status; - size_t packetSize; + std::size_t packetSize; bool (AuthSession::* handler)(); }; diff --git a/src/server/apps/worldserver/CommandLine/CliRunnable.cpp b/src/server/apps/worldserver/CommandLine/CliRunnable.cpp index 83688f1cca..6db897bde2 100644 --- a/src/server/apps/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/apps/worldserver/CommandLine/CliRunnable.cpp @@ -46,7 +46,7 @@ namespace Acore::Impl::Readline static std::vector<std::string> vec; char* cli_unpack_vector(char const*, int state) { - static size_t i=0; + static std::size_t i=0; if (!state) i = 0; if (i < vec.size()) diff --git a/src/server/apps/worldserver/RemoteAccess/RASession.cpp b/src/server/apps/worldserver/RemoteAccess/RASession.cpp index d1cf74e932..06215d0197 100644 --- a/src/server/apps/worldserver/RemoteAccess/RASession.cpp +++ b/src/server/apps/worldserver/RemoteAccess/RASession.cpp @@ -94,7 +94,7 @@ int RASession::Send(std::string_view data) { std::ostream os(&_writeBuffer); os << data; - size_t written = _socket.send(_writeBuffer.data()); + std::size_t written = _socket.send(_writeBuffer.data()); _writeBuffer.consume(written); return written; } @@ -102,7 +102,7 @@ int RASession::Send(std::string_view data) std::string RASession::ReadString() { boost::system::error_code error; - size_t read = boost::asio::read_until(_socket, _readBuffer, "\r\n", error); + std::size_t read = boost::asio::read_until(_socket, _readBuffer, "\r\n", error); if (!read) { _socket.close(); diff --git a/src/server/apps/worldserver/RemoteAccess/RASession.h b/src/server/apps/worldserver/RemoteAccess/RASession.h index c4dd6d861f..b2c8ab948f 100644 --- a/src/server/apps/worldserver/RemoteAccess/RASession.h +++ b/src/server/apps/worldserver/RemoteAccess/RASession.h @@ -26,7 +26,7 @@ using boost::asio::ip::tcp; -const size_t bufferSize = 4096; +const std::size_t bufferSize = 4096; class RASession : public std::enable_shared_from_this<RASession> { diff --git a/src/server/database/Database/DatabaseWorkerPool.cpp b/src/server/database/Database/DatabaseWorkerPool.cpp index 94bc7d22d2..3be45ed401 100644 --- a/src/server/database/Database/DatabaseWorkerPool.cpp +++ b/src/server/database/Database/DatabaseWorkerPool.cpp @@ -151,11 +151,11 @@ bool DatabaseWorkerPool<T>::PrepareStatements() else connection->Unlock(); - size_t const preparedSize = connection->m_stmts.size(); + std::size_t const preparedSize = connection->m_stmts.size(); if (_preparedStatementSize.size() < preparedSize) _preparedStatementSize.resize(preparedSize); - for (size_t i = 0; i < preparedSize; ++i) + for (std::size_t i = 0; i < preparedSize; ++i) { // already set by another connection // (each connection only has prepared statements of it's own type sync/async) @@ -485,7 +485,7 @@ void DatabaseWorkerPool<T>::Enqueue(SQLOperation* op) } template <class T> -size_t DatabaseWorkerPool<T>::QueueSize() const +std::size_t DatabaseWorkerPool<T>::QueueSize() const { return _queue->Size(); } diff --git a/src/server/database/Database/DatabaseWorkerPool.h b/src/server/database/Database/DatabaseWorkerPool.h index 4cf6a2e923..181dd7f581 100644 --- a/src/server/database/Database/DatabaseWorkerPool.h +++ b/src/server/database/Database/DatabaseWorkerPool.h @@ -227,7 +227,7 @@ public: #endif } - [[nodiscard]] size_t QueueSize() const; + [[nodiscard]] std::size_t QueueSize() const; private: uint32 OpenConnections(InternalIndex type, uint8 numConnections); diff --git a/src/server/database/Database/Field.cpp b/src/server/database/Database/Field.cpp index 35f84c2a0a..ad552699d9 100644 --- a/src/server/database/Database/Field.cpp +++ b/src/server/database/Database/Field.cpp @@ -144,7 +144,7 @@ namespace } } -void Field::GetBinarySizeChecked(uint8* buf, size_t length) const +void Field::GetBinarySizeChecked(uint8* buf, std::size_t length) const { ASSERT(data.value && (data.length == length), "Expected {}-byte binary blob, got {}data ({} bytes) instead", length, data.value ? "" : "no ", data.length); memcpy(buf, data.value, length); diff --git a/src/server/database/Database/Field.h b/src/server/database/Database/Field.h index 8496560c3c..6af5cb807c 100644 --- a/src/server/database/Database/Field.h +++ b/src/server/database/Database/Field.h @@ -133,7 +133,7 @@ public: return GetDataBinary(); } - template <typename T, size_t S> + template <typename T, std::size_t S> inline std::enable_if_t<std::is_same_v<Binary, T>, std::array<uint8, S>> Get() const { std::array<uint8, S> buf = {}; @@ -173,7 +173,7 @@ private: QueryResultFieldMetadata const* meta; void LogWrongType(std::string_view getter, std::string_view typeName) const; void SetMetadata(QueryResultFieldMetadata const* fieldMeta); - void GetBinarySizeChecked(uint8* buf, size_t size) const; + void GetBinarySizeChecked(uint8* buf, std::size_t size) const; }; #endif diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp index a77f78d075..54c393c75b 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -464,7 +464,7 @@ int MySQLConnection::ExecuteTransaction(std::shared_ptr<TransactionBase> transac return 0; } -size_t MySQLConnection::EscapeString(char* to, const char* from, size_t length) +std::size_t MySQLConnection::EscapeString(char* to, const char* from, std::size_t length) { return mysql_real_escape_string(m_Mysql, to, from, length); } diff --git a/src/server/database/Database/MySQLConnection.h b/src/server/database/Database/MySQLConnection.h index 08e4f07ac4..2249aafce2 100644 --- a/src/server/database/Database/MySQLConnection.h +++ b/src/server/database/Database/MySQLConnection.h @@ -80,7 +80,7 @@ public: void RollbackTransaction(); void CommitTransaction(); int ExecuteTransaction(std::shared_ptr<TransactionBase> transaction); - size_t EscapeString(char* to, const char* from, size_t length); + std::size_t EscapeString(char* to, const char* from, std::size_t length); void Ping(); uint32 GetLastError(); diff --git a/src/server/database/Database/MySQLPreparedStatement.cpp b/src/server/database/Database/MySQLPreparedStatement.cpp index 0335cf5cbc..a2e95864ba 100644 --- a/src/server/database/Database/MySQLPreparedStatement.cpp +++ b/src/server/database/Database/MySQLPreparedStatement.cpp @@ -190,7 +190,7 @@ std::string MySQLPreparedStatement::getQueryString() const { std::string queryString(m_queryString); - size_t pos = 0; + std::size_t pos = 0; for (PreparedStatementData const& data : m_stmt->GetParameters()) { diff --git a/src/server/database/Database/QueryHolder.cpp b/src/server/database/Database/QueryHolder.cpp index c3c54aad87..c8f4375d76 100644 --- a/src/server/database/Database/QueryHolder.cpp +++ b/src/server/database/Database/QueryHolder.cpp @@ -22,7 +22,7 @@ #include "PreparedStatement.h" #include "QueryResult.h" -bool SQLQueryHolderBase::SetPreparedQueryImpl(size_t index, PreparedStatementBase* stmt) +bool SQLQueryHolderBase::SetPreparedQueryImpl(std::size_t index, PreparedStatementBase* stmt) { if (m_queries.size() <= index) { @@ -34,7 +34,7 @@ bool SQLQueryHolderBase::SetPreparedQueryImpl(size_t index, PreparedStatementBas return true; } -PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(size_t index) const +PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(std::size_t index) const { // Don't call to this function if the index is of a prepared statement ASSERT(index < m_queries.size(), "Query holder result index out of range, tried to access index {} but there are only {} results", @@ -43,7 +43,7 @@ PreparedQueryResult SQLQueryHolderBase::GetPreparedResult(size_t index) const return m_queries[index].second; } -void SQLQueryHolderBase::SetPreparedResult(size_t index, PreparedResultSet* result) +void SQLQueryHolderBase::SetPreparedResult(std::size_t index, PreparedResultSet* result) { if (result && !result->GetRowCount()) { @@ -66,7 +66,7 @@ SQLQueryHolderBase::~SQLQueryHolderBase() } } -void SQLQueryHolderBase::SetSize(size_t size) +void SQLQueryHolderBase::SetSize(std::size_t size) { /// to optimize push_back, reserve the number of queries about to be executed m_queries.resize(size); @@ -77,7 +77,7 @@ SQLQueryHolderTask::~SQLQueryHolderTask() = default; bool SQLQueryHolderTask::Execute() { /// execute all queries in the holder and pass the results - for (size_t i = 0; i < m_holder->m_queries.size(); ++i) + for (std::size_t i = 0; i < m_holder->m_queries.size(); ++i) if (PreparedStatementBase* stmt = m_holder->m_queries[i].first) m_holder->SetPreparedResult(i, m_conn->Query(stmt)); diff --git a/src/server/database/Database/QueryHolder.h b/src/server/database/Database/QueryHolder.h index 63994b487c..2072d71ab7 100644 --- a/src/server/database/Database/QueryHolder.h +++ b/src/server/database/Database/QueryHolder.h @@ -28,12 +28,12 @@ friend class SQLQueryHolderTask; public: SQLQueryHolderBase() = default; virtual ~SQLQueryHolderBase(); - void SetSize(size_t size); - PreparedQueryResult GetPreparedResult(size_t index) const; - void SetPreparedResult(size_t index, PreparedResultSet* result); + void SetSize(std::size_t size); + PreparedQueryResult GetPreparedResult(std::size_t index) const; + void SetPreparedResult(std::size_t index, PreparedResultSet* result); protected: - bool SetPreparedQueryImpl(size_t index, PreparedStatementBase* stmt); + bool SetPreparedQueryImpl(std::size_t index, PreparedStatementBase* stmt); private: std::vector<std::pair<PreparedStatementBase*, PreparedQueryResult>> m_queries; @@ -43,7 +43,7 @@ template<typename T> class SQLQueryHolder : public SQLQueryHolderBase { public: - bool SetPreparedQuery(size_t index, PreparedStatement<T>* stmt) + bool SetPreparedQuery(std::size_t index, PreparedStatement<T>* stmt) { return SetPreparedQueryImpl(index, stmt); } diff --git a/src/server/database/Logging/AppenderDB.cpp b/src/server/database/Logging/AppenderDB.cpp index 1878bb3637..41758f8154 100644 --- a/src/server/database/Logging/AppenderDB.cpp +++ b/src/server/database/Logging/AppenderDB.cpp @@ -19,6 +19,7 @@ #include "DatabaseEnv.h" #include "LogMessage.h" #include "PreparedStatement.h" +#include <vector> AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, AppenderFlags /*flags*/, std::vector<std::string_view> const& /*args*/) : Appender(id, name, level), realmId(0), enabled(false) { } diff --git a/src/server/database/Logging/AppenderDB.h b/src/server/database/Logging/AppenderDB.h index fbafc635c1..7ec576955d 100644 --- a/src/server/database/Logging/AppenderDB.h +++ b/src/server/database/Logging/AppenderDB.h @@ -19,6 +19,7 @@ #define APPENDERDB_H #include "Appender.h" +#include <vector> class AppenderDB : public Appender { diff --git a/src/server/database/Updater/UpdateFetcher.cpp b/src/server/database/Updater/UpdateFetcher.cpp index 3e128ebb56..720662ff6d 100644 --- a/src/server/database/Updater/UpdateFetcher.cpp +++ b/src/server/database/Updater/UpdateFetcher.cpp @@ -240,8 +240,8 @@ UpdateResult UpdateFetcher::Update(bool const redundancyChecks, AppliedFileStorage applied = ReceiveAppliedFiles(); - size_t countRecentUpdates = 0; - size_t countArchivedUpdates = 0; + std::size_t countRecentUpdates = 0; + std::size_t countArchivedUpdates = 0; // Count updates for (auto const& entry : applied) @@ -255,7 +255,7 @@ UpdateResult UpdateFetcher::Update(bool const redundancyChecks, for (auto& entry : applied) hashToName.insert(std::make_pair(entry.second.hash, entry.first)); - size_t importedUpdates = 0; + std::size_t importedUpdates = 0; auto ApplyUpdateFile = [&](LocaleFileEntry const& sqlFile) { @@ -483,7 +483,7 @@ void UpdateFetcher::CleanUp(AppliedFileStorage const& storage) const return; std::stringstream update; - size_t remaining = storage.size(); + std::size_t remaining = storage.size(); update << "DELETE FROM `updates` WHERE `name` IN("; diff --git a/src/server/database/Updater/UpdateFetcher.h b/src/server/database/Updater/UpdateFetcher.h index ca9918f484..ca7d8c2d82 100644 --- a/src/server/database/Updater/UpdateFetcher.h +++ b/src/server/database/Updater/UpdateFetcher.h @@ -31,12 +31,12 @@ struct AC_DATABASE_API UpdateResult UpdateResult() : updated(0), recent(0), archived(0) { } - UpdateResult(size_t const updated_, size_t const recent_, size_t const archived_) + UpdateResult(std::size_t const updated_, std::size_t const recent_, std::size_t const archived_) : updated(updated_), recent(recent_), archived(archived_) { } - size_t updated; - size_t recent; - size_t archived; + std::size_t updated; + std::size_t recent; + std::size_t archived; }; class AC_DATABASE_API UpdateFetcher diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index a3d759a6d2..2d8a1bd307 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -480,9 +480,9 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) { - size_t paramsStructSize = [&]() -> size_t + std::size_t paramsStructSize = [&]() -> std::size_t { - constexpr size_t NO_PARAMS = size_t(0); + constexpr std::size_t NO_PARAMS = std::size_t(0); switch (e.event.type) { case SMART_EVENT_UPDATE_IC: return sizeof(SmartEvent::minMaxRepeat); @@ -584,11 +584,11 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) } }(); - static size_t rawCount = sizeof(SmartEvent::raw) / sizeof(uint32); - size_t paramsCount = paramsStructSize / sizeof(uint32); + static std::size_t rawCount = sizeof(SmartEvent::raw) / sizeof(uint32); + std::size_t paramsCount = paramsStructSize / sizeof(uint32); bool valid = true; - for (size_t index = paramsCount; index < rawCount; index++) + for (std::size_t index = paramsCount; index < rawCount; index++) { uint32 value = ((uint32*)&e.event.raw)[index]; if (value != 0) @@ -604,9 +604,9 @@ bool SmartAIMgr::CheckUnusedEventParams(SmartScriptHolder const& e) bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) { - size_t paramsStructSize = [&]() -> size_t + std::size_t paramsStructSize = [&]() -> std::size_t { - constexpr size_t NO_PARAMS = size_t(0); + constexpr std::size_t NO_PARAMS = std::size_t(0); switch (e.action.type) { case SMART_ACTION_NONE: return NO_PARAMS; @@ -784,11 +784,11 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) } }(); - static size_t rawCount = sizeof(SmartAction::raw) / sizeof(uint32); - size_t paramsCount = paramsStructSize / sizeof(uint32); + static std::size_t rawCount = sizeof(SmartAction::raw) / sizeof(uint32); + std::size_t paramsCount = paramsStructSize / sizeof(uint32); bool valid = true; - for (size_t index = paramsCount; index < rawCount; index++) + for (std::size_t index = paramsCount; index < rawCount; index++) { uint32 value = ((uint32*)&e.action.raw)[index]; if (value != 0) @@ -804,9 +804,9 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e) bool SmartAIMgr::CheckUnusedTargetParams(SmartScriptHolder const& e) { - size_t paramsStructSize = [&]() -> size_t + std::size_t paramsStructSize = [&]() -> std::size_t { - constexpr size_t NO_PARAMS = size_t(0); + constexpr std::size_t NO_PARAMS = std::size_t(0); switch (e.target.type) { case SMART_TARGET_NONE: return NO_PARAMS; @@ -848,11 +848,11 @@ bool SmartAIMgr::CheckUnusedTargetParams(SmartScriptHolder const& e) } }(); - static size_t rawCount = sizeof(SmartTarget::raw) / sizeof(uint32); - size_t paramsCount = paramsStructSize / sizeof(uint32); + static std::size_t rawCount = sizeof(SmartTarget::raw) / sizeof(uint32); + std::size_t paramsCount = paramsStructSize / sizeof(uint32); bool valid = true; - for (size_t index = paramsCount; index < rawCount; index++) + for (std::size_t index = paramsCount; index < rawCount; index++) { uint32 value = ((uint32*)&e.target.raw)[index]; if (value != 0) diff --git a/src/server/game/AI/enuminfo_CreatureAI.cpp b/src/server/game/AI/enuminfo_CreatureAI.cpp index 3cb4c7e158..12b2b20b89 100644 --- a/src/server/game/AI/enuminfo_CreatureAI.cpp +++ b/src/server/game/AI/enuminfo_CreatureAI.cpp @@ -40,10 +40,10 @@ AC_API_EXPORT EnumText EnumUtils<CreatureAI::EvadeReason>::ToString(CreatureAI:: } template <> -AC_API_EXPORT size_t EnumUtils<CreatureAI::EvadeReason>::Count() { return 4; } +AC_API_EXPORT std::size_t EnumUtils<CreatureAI::EvadeReason>::Count() { return 4; } template <> -AC_API_EXPORT CreatureAI::EvadeReason EnumUtils<CreatureAI::EvadeReason>::FromIndex(size_t index) +AC_API_EXPORT CreatureAI::EvadeReason EnumUtils<CreatureAI::EvadeReason>::FromIndex(std::size_t index) { switch (index) { @@ -56,7 +56,7 @@ AC_API_EXPORT CreatureAI::EvadeReason EnumUtils<CreatureAI::EvadeReason>::FromIn } template <> -AC_API_EXPORT size_t EnumUtils<CreatureAI::EvadeReason>::ToIndex(CreatureAI::EvadeReason value) +AC_API_EXPORT std::size_t EnumUtils<CreatureAI::EvadeReason>::ToIndex(CreatureAI::EvadeReason value) { switch (value) { diff --git a/src/server/game/ArenaSpectator/ArenaSpectator.cpp b/src/server/game/ArenaSpectator/ArenaSpectator.cpp index 049f2fcdca..fd4faf7006 100644 --- a/src/server/game/ArenaSpectator/ArenaSpectator.cpp +++ b/src/server/game/ArenaSpectator/ArenaSpectator.cpp @@ -212,7 +212,7 @@ bool ArenaSpectator::HandleSpectatorWatchCommand(ChatHandler* handler, std::stri void ArenaSpectator::CreatePacket(WorldPacket& data, std::string const& message) { - size_t len = message.length(); + std::size_t len = message.length(); data.Initialize(SMSG_MESSAGECHAT, 1 + 4 + 8 + 4 + 8 + 4 + 1 + len + 1); data << uint8(CHAT_MSG_WHISPER); data << uint32(LANG_ADDON); diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h index e66a184118..2bac7b5716 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.h +++ b/src/server/game/Battlegrounds/ArenaTeam.h @@ -167,7 +167,7 @@ public: // and this method removes given record from list. So invalid reference can happen. void DelMember(ObjectGuid guid, bool cleanDb); - [[nodiscard]] size_t GetMembersSize() const { return Members.size(); } + [[nodiscard]] std::size_t GetMembersSize() const { return Members.size(); } [[nodiscard]] bool Empty() const { return Members.empty(); } MemberList::iterator m_membersBegin() { return Members.begin(); } MemberList::iterator m_membersEnd() { return Members.end(); } diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index db6b96b5be..4874cf1575 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -608,7 +608,7 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid *data << uint32(0); // unk (count?) else // battleground { - size_t count_pos = data->wpos(); + std::size_t count_pos = data->wpos(); *data << uint32(0); // number of bg instances auto const& it = bgDataStore.find(bgTypeId); diff --git a/src/server/game/Battlegrounds/enuminfo_ArenaTeam.cpp b/src/server/game/Battlegrounds/enuminfo_ArenaTeam.cpp index 078185dd0d..952a2458e4 100644 --- a/src/server/game/Battlegrounds/enuminfo_ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/enuminfo_ArenaTeam.cpp @@ -39,10 +39,10 @@ AC_API_EXPORT EnumText EnumUtils<ArenaTeamTypes>::ToString(ArenaTeamTypes value) } template <> -AC_API_EXPORT size_t EnumUtils<ArenaTeamTypes>::Count() { return 3; } +AC_API_EXPORT std::size_t EnumUtils<ArenaTeamTypes>::Count() { return 3; } template <> -AC_API_EXPORT ArenaTeamTypes EnumUtils<ArenaTeamTypes>::FromIndex(size_t index) +AC_API_EXPORT ArenaTeamTypes EnumUtils<ArenaTeamTypes>::FromIndex(std::size_t index) { switch (index) { @@ -54,7 +54,7 @@ AC_API_EXPORT ArenaTeamTypes EnumUtils<ArenaTeamTypes>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<ArenaTeamTypes>::ToIndex(ArenaTeamTypes value) +AC_API_EXPORT std::size_t EnumUtils<ArenaTeamTypes>::ToIndex(ArenaTeamTypes value) { switch (value) { diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index 5982599fd9..12cdf0ae44 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -182,7 +182,7 @@ void CalendarMgr::RemoveEvent(CalendarEvent* calendarEvent, ObjectGuid remover) MailDraft mail(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody()); CalendarInviteStore& eventInvites = _invites[calendarEvent->GetEventId()]; - for (size_t i = 0; i < eventInvites.size(); ++i) + for (std::size_t i = 0; i < eventInvites.size(); ++i) { CalendarInvite* invite = eventInvites[i]; stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE); diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 73b0a5e149..8d459d4ecd 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -706,7 +706,7 @@ void Channel::List(Player const* player) data << GetName(); // channel name data << uint8(GetFlags()); // channel flags? - size_t pos = data.wpos(); + std::size_t pos = data.wpos(); data << uint32(0); // size of list, placeholder uint32 count = 0; diff --git a/src/server/game/Chat/Channels/enuminfo_Channel.cpp b/src/server/game/Chat/Channels/enuminfo_Channel.cpp index 137aa2e9e5..b6ad0335dc 100644 --- a/src/server/game/Chat/Channels/enuminfo_Channel.cpp +++ b/src/server/game/Chat/Channels/enuminfo_Channel.cpp @@ -72,10 +72,10 @@ AC_API_EXPORT EnumText EnumUtils<ChatNotify>::ToString(ChatNotify value) } template <> -AC_API_EXPORT size_t EnumUtils<ChatNotify>::Count() { return 36; } +AC_API_EXPORT std::size_t EnumUtils<ChatNotify>::Count() { return 36; } template <> -AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(size_t index) +AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(std::size_t index) { switch (index) { @@ -120,7 +120,7 @@ AC_API_EXPORT ChatNotify EnumUtils<ChatNotify>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<ChatNotify>::ToIndex(ChatNotify value) +AC_API_EXPORT std::size_t EnumUtils<ChatNotify>::ToIndex(ChatNotify value) { switch (value) { diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 9cd64c8a17..764ef3c70c 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -145,7 +145,7 @@ void ChatHandler::SendSysMessage(std::string_view str, bool escapeCharacters) std::vector<std::string_view> tokens = Acore::Tokenize(msg, '|', true); std::ostringstream stream; - for (size_t i = 0; i < tokens.size() - 1; ++i) + for (std::size_t i = 0; i < tokens.size() - 1; ++i) stream << tokens[i] << "||"; stream << tokens[tokens.size() - 1]; @@ -240,11 +240,11 @@ bool ChatHandler::ParseCommands(std::string_view text) return _ParseCommands(text.substr(1)); } -size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, +std::size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const& senderName /*= ""*/, std::string const& receiverName /*= ""*/, uint32 achievementId /*= 0*/, bool gmMessage /*= false*/, std::string const& channelName /*= ""*/) { - size_t receiverGUIDPos = 0; + std::size_t receiverGUIDPos = 0; data.Initialize(!gmMessage ? SMSG_MESSAGECHAT : SMSG_GM_MESSAGECHAT); data << uint8(chatType); data << int32(language); @@ -320,7 +320,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag return receiverGUIDPos; } -size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, +std::size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId /*= 0*/, std::string const& channelName /*= ""*/, LocaleConstant locale /*= DEFAULT_LOCALE*/) { ObjectGuid senderGUID; @@ -1022,7 +1022,7 @@ void AddonChannelCommandHandler::SendSysMessage(std::string_view str, bool escap std::string body(str); if (escapeCharacters) boost::replace_all(body, "|", "||"); - size_t pos, lastpos; + std::size_t pos, lastpos; for (lastpos = 0, pos = body.find('\n', lastpos); pos != std::string::npos; lastpos = pos + 1, pos = body.find('\n', lastpos)) { std::string line(msg); diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index 17642a46d5..61dc38cda7 100644 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -42,12 +42,12 @@ public: virtual ~ChatHandler() { } // Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders - static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, + static std::size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const& senderName = "", std::string const& receiverName = "", uint32 achievementId = 0, bool gmMessage = false, std::string const& channelName = ""); // Builds chat packet and returns receiver guid position in the packet to substitute in whisper builders - static size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE); + static std::size_t BuildChatPacket(WorldPacket& data, ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId = 0, std::string const& channelName = "", LocaleConstant locale = DEFAULT_LOCALE); static char* LineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; } diff --git a/src/server/game/Chat/ChatCommands/ChatCommand.cpp b/src/server/game/Chat/ChatCommands/ChatCommand.cpp index 4ff2c34fbc..916b83919e 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommand.cpp +++ b/src/server/game/Chat/ChatCommands/ChatCommand.cpp @@ -58,7 +58,7 @@ void Acore::Impl::ChatCommands::ChatCommandNode::LoadFromBuilder(ChatCommandBuil std::vector<std::string_view> const tokens = Acore::Tokenize(builder._name, COMMAND_DELIMITER, false); ASSERT(!tokens.empty(), "Invalid command name '{}'.", builder._name); ChatSubCommandMap* subMap = ↦ - for (size_t i = 0, n = (tokens.size() - 1); i < n; ++i) + for (std::size_t i = 0, n = (tokens.size() - 1); i < n; ++i) subMap = &((*subMap)[tokens[i]]._subCommands); ((*subMap)[tokens.back()]).LoadFromBuilder(builder); } diff --git a/src/server/game/Chat/ChatCommands/ChatCommand.h b/src/server/game/Chat/ChatCommands/ChatCommand.h index 4f51206be8..079f40a50a 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommand.h +++ b/src/server/game/Chat/ChatCommands/ChatCommand.h @@ -55,10 +55,10 @@ namespace Acore::Impl::ChatCommands // ConsumeFromOffset contains the bounds check for offset, then hands off to MultiConsumer // the call stack is MultiConsumer -> ConsumeFromOffset -> MultiConsumer -> ConsumeFromOffset etc // MultiConsumer goes into ArgInfo for parsing on each iteration - template <typename Tuple, size_t offset> + template <typename Tuple, std::size_t offset> ChatCommandResult ConsumeFromOffset(Tuple&, ChatHandler const* handler, std::string_view args); - template <typename Tuple, typename NextType, size_t offset> + template <typename Tuple, typename NextType, std::size_t offset> struct MultiConsumer { static ChatCommandResult TryConsumeTo(Tuple& tuple, ChatHandler const* handler, std::string_view args) @@ -71,7 +71,7 @@ namespace Acore::Impl::ChatCommands } }; - template <typename Tuple, typename NestedNextType, size_t offset> + template <typename Tuple, typename NestedNextType, std::size_t offset> struct MultiConsumer<Tuple, Optional<NestedNextType>, offset> { static ChatCommandResult TryConsumeTo(Tuple& tuple, ChatHandler const* handler, std::string_view args) @@ -102,7 +102,7 @@ namespace Acore::Impl::ChatCommands } }; - template <typename Tuple, size_t offset> + template <typename Tuple, std::size_t offset> ChatCommandResult ConsumeFromOffset([[maybe_unused]] Tuple& tuple, [[maybe_unused]] ChatHandler const* handler, std::string_view args) { if constexpr (offset < std::tuple_size_v<Tuple>) diff --git a/src/server/game/Chat/ChatCommands/ChatCommandArgs.h b/src/server/game/Chat/ChatCommands/ChatCommandArgs.h index d151dcc270..524cc608e0 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandArgs.h +++ b/src/server/game/Chat/ChatCommands/ChatCommandArgs.h @@ -237,7 +237,7 @@ namespace Acore::Impl::ChatCommands }; // fixed-size array - template <typename T, size_t N> + template <typename T, std::size_t N> struct ArgInfo<std::array<T, N>, void> { static ChatCommandResult TryConsume(std::array<T, N>& val, ChatHandler const* handler, std::string_view args) @@ -255,9 +255,9 @@ namespace Acore::Impl::ChatCommands struct ArgInfo<Acore::ChatCommands::Variant<Ts...>> { using V = std::variant<Ts...>; - static constexpr size_t N = std::variant_size_v<V>; + static constexpr std::size_t N = std::variant_size_v<V>; - template <size_t I> + template <std::size_t I> static ChatCommandResult TryAtIndex([[maybe_unused]] Acore::ChatCommands::Variant<Ts...>& val, [[maybe_unused]] ChatHandler const* handler, [[maybe_unused]] std::string_view args) { if constexpr (I < N) diff --git a/src/server/game/Chat/ChatCommands/ChatCommandHelpers.h b/src/server/game/Chat/ChatCommands/ChatCommandHelpers.h index dac07038d9..f5b4cf5afa 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandHelpers.h +++ b/src/server/game/Chat/ChatCommands/ChatCommandHelpers.h @@ -55,10 +55,10 @@ namespace Acore::Impl::ChatCommands inline TokenizeResult tokenize(std::string_view args) { TokenizeResult result; - if (size_t delimPos = args.find(COMMAND_DELIMITER); delimPos != std::string_view::npos) + if (std::size_t delimPos = args.find(COMMAND_DELIMITER); delimPos != std::string_view::npos) { result.token = args.substr(0, delimPos); - if (size_t tailPos = args.find_first_not_of(COMMAND_DELIMITER, delimPos); tailPos != std::string_view::npos) + if (std::size_t tailPos = args.find_first_not_of(COMMAND_DELIMITER, delimPos); tailPos != std::string_view::npos) result.tail = args.substr(tailPos); } else diff --git a/src/server/game/Chat/ChatCommands/ChatCommandTags.cpp b/src/server/game/Chat/ChatCommands/ChatCommandTags.cpp index e9510e2f9b..57e678d13b 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandTags.cpp +++ b/src/server/game/Chat/ChatCommands/ChatCommandTags.cpp @@ -34,7 +34,7 @@ ChatCommandResult Acore::ChatCommands::QuotedString::TryConsume(ChatHandler cons return ArgInfo<std::string>::TryConsume(*this, handler, args); char const QUOTE = args[0]; - for (size_t i = 1; i < args.length(); ++i) + for (std::size_t i = 1; i < args.length(); ++i) { if (args[i] == QUOTE) { diff --git a/src/server/game/Chat/ChatCommands/ChatCommandTags.h b/src/server/game/Chat/ChatCommands/ChatCommandTags.h index bfc61504f3..f5c25a639f 100644 --- a/src/server/game/Chat/ChatCommands/ChatCommandTags.h +++ b/src/server/game/Chat/ChatCommands/ChatCommandTags.h @@ -51,8 +51,8 @@ namespace Acore::Impl::ChatCommands using type = typename T::value_type; }; - template <size_t N> - inline constexpr char GetChar(char const (&s)[N], size_t i) + template <std::size_t N> + inline constexpr char GetChar(char const (&s)[N], std::size_t i) { static_assert(N <= 25, "The EXACT_SEQUENCE macro can only be used with up to 25 character long literals. Specify them char-by-char (null terminated) as parameters to ExactSequence<> instead."); return i >= N ? '\0' : s[i]; @@ -273,7 +273,7 @@ namespace Acore::ChatCommands } template<bool C = have_operators> - operator std::enable_if_t<C && !std::is_same_v<first_type, size_t> && std::is_convertible_v<first_type, size_t>, size_t>() const + operator std::enable_if_t<C && !std::is_same_v<first_type, std::size_t> && std::is_convertible_v<first_type, std::size_t>, std::size_t>() const { return operator*(); } @@ -284,9 +284,9 @@ namespace Acore::ChatCommands template <typename T> Variant& operator=(T&& arg) { base::operator=(std::forward<T>(arg)); return *this; } - template <size_t index> + template <std::size_t index> constexpr decltype(auto) get() { return std::get<index>(static_cast<base&>(*this)); } - template <size_t index> + template <std::size_t index> constexpr decltype(auto) get() const { return std::get<index>(static_cast<base const&>(*this)); } template <typename type> constexpr decltype(auto) get() { return std::get<type>(static_cast<base&>(*this)); } diff --git a/src/server/game/Chat/HyperlinkTags.cpp b/src/server/game/Chat/HyperlinkTags.cpp index 49efa0b2f5..342ba30357 100644 --- a/src/server/game/Chat/HyperlinkTags.cpp +++ b/src/server/game/Chat/HyperlinkTags.cpp @@ -35,7 +35,7 @@ class HyperlinkDataTokenizer if (IsEmpty()) return false; - if (size_t off = _str.find(HYPERLINK_DATA_DELIMITER); off != std::string_view::npos) + if (std::size_t off = _str.find(HYPERLINK_DATA_DELIMITER); off != std::string_view::npos) { if (!Acore::Hyperlinks::LinkTags::base_tag::StoreTo(val, _str.substr(0, off))) return false; diff --git a/src/server/game/Chat/Hyperlinks.cpp b/src/server/game/Chat/Hyperlinks.cpp index b55f36191b..6cc124e800 100644 --- a/src/server/game/Chat/Hyperlinks.cpp +++ b/src/server/game/Chat/Hyperlinks.cpp @@ -61,7 +61,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str) str.remove_prefix(2); // tag+data part follows - if (size_t delimPos = str.find('|'); delimPos != std::string_view::npos) + if (std::size_t delimPos = str.find('|'); delimPos != std::string_view::npos) { tag = str.substr(0, delimPos); str.remove_prefix(delimPos+1); @@ -70,7 +70,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str) return {}; // split tag if : is present (data separator) - if (size_t dataStart = tag.find(':'); dataStart != std::string_view::npos) + if (std::size_t dataStart = tag.find(':'); dataStart != std::string_view::npos) { data = tag.substr(dataStart+1); tag = tag.substr(0, dataStart); @@ -81,7 +81,7 @@ HyperlinkInfo Acore::Hyperlinks::ParseSingleHyperlink(std::string_view str) return {}; str.remove_prefix(1); // skip to final | - if (size_t end = str.find('|'); end != std::string_view::npos) + if (std::size_t end = str.find('|'); end != std::string_view::npos) { // check end tag if (str.substr(end, 4) != "|h|r") diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 077ef5d5e8..f0b1f75f77 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -337,7 +337,7 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, std::string const data << uint32(eEmote._Emote); // NPC emote } - size_t count_pos = data.wpos(); + std::size_t count_pos = data.wpos(); data << uint8(0); uint32 count = 0; diff --git a/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp b/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp index 80a6de93ab..b1af41ce3b 100644 --- a/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp +++ b/src/server/game/Entities/Creature/enuminfo_CreatureData.cpp @@ -68,10 +68,10 @@ AC_API_EXPORT EnumText EnumUtils<CreatureFlagsExtra>::ToString(CreatureFlagsExtr } template <> -AC_API_EXPORT size_t EnumUtils<CreatureFlagsExtra>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<CreatureFlagsExtra>::Count() { return 32; } template <> -AC_API_EXPORT CreatureFlagsExtra EnumUtils<CreatureFlagsExtra>::FromIndex(size_t index) +AC_API_EXPORT CreatureFlagsExtra EnumUtils<CreatureFlagsExtra>::FromIndex(std::size_t index) { switch (index) { @@ -112,7 +112,7 @@ AC_API_EXPORT CreatureFlagsExtra EnumUtils<CreatureFlagsExtra>::FromIndex(size_t } template <> -AC_API_EXPORT size_t EnumUtils<CreatureFlagsExtra>::ToIndex(CreatureFlagsExtra value) +AC_API_EXPORT std::size_t EnumUtils<CreatureFlagsExtra>::ToIndex(CreatureFlagsExtra value) { switch (value) { diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 9311e9202b..7c62b77980 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -48,7 +48,7 @@ void AddItemsSetItem(Player* player, Item* item) ItemSetEffect* eff = nullptr; - for (size_t x = 0; x < player->ItemSetEff.size(); ++x) + for (std::size_t x = 0; x < player->ItemSetEff.size(); ++x) { if (player->ItemSetEff[x] && player->ItemSetEff[x]->setid == setid) { @@ -62,7 +62,7 @@ void AddItemsSetItem(Player* player, Item* item) eff = new ItemSetEffect(); eff->setid = setid; - size_t x = 0; + std::size_t x = 0; for (; x < player->ItemSetEff.size(); ++x) if (!player->ItemSetEff[x]) break; @@ -129,7 +129,7 @@ void RemoveItemsSetItem(Player* player, ItemTemplate const* proto) } ItemSetEffect* eff = nullptr; - size_t setindex = 0; + std::size_t setindex = 0; for (; setindex < player->ItemSetEff.size(); setindex++) { if (player->ItemSetEff[setindex] && player->ItemSetEff[setindex]->setid == setid) diff --git a/src/server/game/Entities/Item/enuminfo_Item.cpp b/src/server/game/Entities/Item/enuminfo_Item.cpp index a7b1ecc352..54edf959bc 100644 --- a/src/server/game/Entities/Item/enuminfo_Item.cpp +++ b/src/server/game/Entities/Item/enuminfo_Item.cpp @@ -124,10 +124,10 @@ AC_API_EXPORT EnumText EnumUtils<InventoryResult>::ToString(InventoryResult valu } template <> -AC_API_EXPORT size_t EnumUtils<InventoryResult>::Count() { return 88; } +AC_API_EXPORT std::size_t EnumUtils<InventoryResult>::Count() { return 88; } template <> -AC_API_EXPORT InventoryResult EnumUtils<InventoryResult>::FromIndex(size_t index) +AC_API_EXPORT InventoryResult EnumUtils<InventoryResult>::FromIndex(std::size_t index) { switch (index) { @@ -224,7 +224,7 @@ AC_API_EXPORT InventoryResult EnumUtils<InventoryResult>::FromIndex(size_t index } template <> -AC_API_EXPORT size_t EnumUtils<InventoryResult>::ToIndex(InventoryResult value) +AC_API_EXPORT std::size_t EnumUtils<InventoryResult>::ToIndex(InventoryResult value) { switch (value) { @@ -342,10 +342,10 @@ AC_API_EXPORT EnumText EnumUtils<BuyResult>::ToString(BuyResult value) } template <> -AC_API_EXPORT size_t EnumUtils<BuyResult>::Count() { return 9; } +AC_API_EXPORT std::size_t EnumUtils<BuyResult>::Count() { return 9; } template <> -AC_API_EXPORT BuyResult EnumUtils<BuyResult>::FromIndex(size_t index) +AC_API_EXPORT BuyResult EnumUtils<BuyResult>::FromIndex(std::size_t index) { switch (index) { @@ -363,7 +363,7 @@ AC_API_EXPORT BuyResult EnumUtils<BuyResult>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<BuyResult>::ToIndex(BuyResult value) +AC_API_EXPORT std::size_t EnumUtils<BuyResult>::ToIndex(BuyResult value) { switch (value) { @@ -402,10 +402,10 @@ AC_API_EXPORT EnumText EnumUtils<SellResult>::ToString(SellResult value) } template <> -AC_API_EXPORT size_t EnumUtils<SellResult>::Count() { return 9; } +AC_API_EXPORT std::size_t EnumUtils<SellResult>::Count() { return 9; } template <> -AC_API_EXPORT SellResult EnumUtils<SellResult>::FromIndex(size_t index) +AC_API_EXPORT SellResult EnumUtils<SellResult>::FromIndex(std::size_t index) { switch (index) { @@ -423,7 +423,7 @@ AC_API_EXPORT SellResult EnumUtils<SellResult>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SellResult>::ToIndex(SellResult value) +AC_API_EXPORT std::size_t EnumUtils<SellResult>::ToIndex(SellResult value) { switch (value) { diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index b419531a63..3147c41ab7 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -31,6 +31,7 @@ #include "Position.h" #include "UpdateData.h" #include "UpdateMask.h" +#include <memory> #include <set> #include <sstream> #include <string> diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index 94363d6f5b..eb69c7d120 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -321,7 +321,7 @@ namespace std struct hash<ObjectGuid> { public: - size_t operator()(ObjectGuid const& key) const + std::size_t operator()(ObjectGuid const& key) const { return std::hash<uint64>()(key.GetRawValue()); } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2beff79364..9bacc91332 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -434,7 +434,7 @@ Player::~Player() delete PlayerTalkClass; - for (size_t x = 0; x < ItemSetEff.size(); x++) + for (std::size_t x = 0; x < ItemSetEff.size(); x++) delete ItemSetEff[x]; delete m_declinedname; @@ -2749,7 +2749,7 @@ void Player::SendInitialSpells() WorldPacket data(SMSG_INITIAL_SPELLS, (1 + 2 + 4 * m_spells.size() + 2 + m_spellCooldowns.size() * (4 + 2 + 2 + 4 + 4))); data << uint8(0); - size_t countPos = data.wpos(); + std::size_t countPos = data.wpos(); data << uint16(spellCount); // spell count placeholder for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) @@ -8153,7 +8153,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(mapid); // mapid data << uint32(zoneid); // zone id data << uint32(areaid); // area id, new 2.1.0 - size_t countPos = data.wpos(); + std::size_t countPos = data.wpos(); data << uint16(0); // count of uint64 blocks data << uint32(0x8d8) << uint32(0x0); // 1 data << uint32(0x8d7) << uint32(0x0); // 2 @@ -9442,7 +9442,7 @@ void Player::PetSpellInitialize() // action bar loop charmInfo->BuildActionBar(&data); - size_t spellsCountPos = data.wpos(); + std::size_t spellsCountPos = data.wpos(); // spells count uint8 addlist = 0; @@ -14270,7 +14270,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket* data) for (uint32 specIdx = 0; specIdx < m_specsCount; ++specIdx) { uint8 talentIdCount = 0; - size_t pos = data->wpos(); + std::size_t pos = data->wpos(); *data << uint8(talentIdCount); // [PH], talentIdCount const PlayerTalentMap& talentMap = GetTalentMap(); @@ -14295,11 +14295,11 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket* data) void Player::BuildPetTalentsInfoData(WorldPacket* data) { uint32 unspentTalentPoints = 0; - size_t pointsPos = data->wpos(); + std::size_t pointsPos = data->wpos(); *data << uint32(unspentTalentPoints); // [PH], unspentTalentPoints uint8 talentIdCount = 0; - size_t countPos = data->wpos(); + std::size_t countPos = data->wpos(); *data << uint8(talentIdCount); // [PH], talentIdCount Pet* pet = GetPet(); @@ -14378,7 +14378,7 @@ void Player::SendTalentsInfoData(bool pet) void Player::BuildEnchantmentsInfoData(WorldPacket* data) { uint32 slotUsedMask = 0; - size_t slotUsedMaskPos = data->wpos(); + std::size_t slotUsedMaskPos = data->wpos(); *data << uint32(slotUsedMask); // slotUsedMask < 0x80000 for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) @@ -14393,7 +14393,7 @@ void Player::BuildEnchantmentsInfoData(WorldPacket* data) *data << uint32(item->GetEntry()); // item entry uint16 enchantmentMask = 0; - size_t enchantmentMaskPos = data->wpos(); + std::size_t enchantmentMaskPos = data->wpos(); *data << uint16(enchantmentMask); // enchantmentMask < 0x1000 for (uint32 j = 0; j < MAX_ENCHANTMENT_SLOT; ++j) @@ -14422,7 +14422,7 @@ void Player::SendEquipmentSetList() { uint32 count = 0; WorldPacket data(SMSG_EQUIPMENT_SET_LIST, 4); - size_t count_pos = data.wpos(); + std::size_t count_pos = data.wpos(); data << uint32(count); // count placeholder for (EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr) { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index d9ab3e60b4..c888310b0b 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1609,7 +1609,7 @@ public: QuestStatusMap& getQuestStatusMap() { return m_QuestStatus; } QuestStatusSaveMap& GetQuestStatusSaveMap() { return m_QuestStatusSave; } - [[nodiscard]] size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); } + [[nodiscard]] std::size_t GetRewardedQuestCount() const { return m_RewardedQuests.size(); } [[nodiscard]] bool IsQuestRewarded(uint32 quest_id) const { return m_RewardedQuests.find(quest_id) != m_RewardedQuests.end(); diff --git a/src/server/game/Entities/Player/PlayerStorage.cpp b/src/server/game/Entities/Player/PlayerStorage.cpp index eec6bd9d3c..4fcdc5602d 100644 --- a/src/server/game/Entities/Player/PlayerStorage.cpp +++ b/src/server/game/Entities/Player/PlayerStorage.cpp @@ -6537,7 +6537,7 @@ void Player::SendRaidInfo() WorldPacket data(SMSG_RAID_INSTANCE_INFO, 4); - size_t p_counter = data.wpos(); + std::size_t p_counter = data.wpos(); data << uint32(counter); // placeholder time_t now = GameTime::GetGameTime().count(); @@ -7318,7 +7318,7 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) return; ObjectGuid::LowType lowGuid = GetGUID().GetCounter(); - for (size_t i = 0; i < m_itemUpdateQueue.size(); ++i) + for (std::size_t i = 0; i < m_itemUpdateQueue.size(); ++i) { Item* item = m_itemUpdateQueue[i]; if (!item) diff --git a/src/server/game/Entities/Player/PlayerTaxi.cpp b/src/server/game/Entities/Player/PlayerTaxi.cpp index 36fda1f9c5..9c56f58243 100644 --- a/src/server/game/Entities/Player/PlayerTaxi.cpp +++ b/src/server/game/Entities/Player/PlayerTaxi.cpp @@ -170,7 +170,7 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, TeamI return false; } - for (size_t i = 1; i < m_TaxiDestinations.size(); ++i) + for (std::size_t i = 1; i < m_TaxiDestinations.size(); ++i) { uint32 cost; uint32 path; @@ -202,7 +202,7 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString() std::ostringstream ss; ss << m_flightMasterFactionId << ' '; - for (size_t i = 0; i < m_TaxiDestinations.size(); ++i) + for (std::size_t i = 0; i < m_TaxiDestinations.size(); ++i) { ss << m_TaxiDestinations[i] << ' '; } diff --git a/src/server/game/Entities/Player/PlayerUpdates.cpp b/src/server/game/Entities/Player/PlayerUpdates.cpp index 263033a083..c8fc7a8493 100644 --- a/src/server/game/Entities/Player/PlayerUpdates.cpp +++ b/src/server/game/Entities/Player/PlayerUpdates.cpp @@ -864,7 +864,7 @@ bool Player::UpdateFishingSkill() // bonus abilities in sSkillLineAbilityStore // Used only to avoid scan DBC at each skill grow static uint32 bonusSkillLevels[] = {75, 150, 225, 300, 375, 450}; -static const size_t bonusSkillLevelsSize = +static const std::size_t bonusSkillLevelsSize = sizeof(bonusSkillLevels) / sizeof(uint32); bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) @@ -908,7 +908,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) if (itr->second.uState != SKILL_NEW) itr->second.uState = SKILL_CHANGED; - for (size_t i = 0; i < bonusSkillLevelsSize; ++i) + for (std::size_t i = 0; i < bonusSkillLevelsSize; ++i) { uint32 bsl = bonusSkillLevels[i]; if (SkillValue < bsl && new_value >= bsl) @@ -1322,7 +1322,7 @@ void Player::UpdateEquipSpellsAtFormChange() } // item set bonuses not dependent from item broken state - for (size_t setindex = 0; setindex < ItemSetEff.size(); ++setindex) + for (std::size_t setindex = 0; setindex < ItemSetEff.size(); ++setindex) { ItemSetEffect* eff = ItemSetEff[setindex]; if (!eff) diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 487e411172..e66f52629a 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -132,7 +132,7 @@ void PlayerSocial::SendSocialList(Player* player, uint32 flags) WorldPacket data(SMSG_CONTACT_LIST, (4 + 4 + m_playerSocialMap.size() * 25)); // just can guess size data << uint32(flags); // 0x1 = Friendlist update. 0x2 = Ignorelist update. 0x4 = Mutelist update. - size_t countPos = data.wpos(); + std::size_t countPos = data.wpos(); data << uint32(0); // contacts count placeholder for (auto& itr : m_playerSocialMap) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f56404dc6d..5293d76bfe 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6467,7 +6467,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo) ++count; } - size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12; + std::size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12; WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size data << uint32(damageInfo->HitInfo); data << damageInfo->attacker->GetPackGUID(); diff --git a/src/server/game/Entities/Unit/enuminfo_Unit.cpp b/src/server/game/Entities/Unit/enuminfo_Unit.cpp index a3c4938c61..01747bdb69 100644 --- a/src/server/game/Entities/Unit/enuminfo_Unit.cpp +++ b/src/server/game/Entities/Unit/enuminfo_Unit.cpp @@ -69,10 +69,10 @@ AC_API_EXPORT EnumText EnumUtils<UnitFlags>::ToString(UnitFlags value) } template <> -AC_API_EXPORT size_t EnumUtils<UnitFlags>::Count() { return 33; } +AC_API_EXPORT std::size_t EnumUtils<UnitFlags>::Count() { return 33; } template <> -AC_API_EXPORT UnitFlags EnumUtils<UnitFlags>::FromIndex(size_t index) +AC_API_EXPORT UnitFlags EnumUtils<UnitFlags>::FromIndex(std::size_t index) { switch (index) { @@ -114,7 +114,7 @@ AC_API_EXPORT UnitFlags EnumUtils<UnitFlags>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<UnitFlags>::ToIndex(UnitFlags value) +AC_API_EXPORT std::size_t EnumUtils<UnitFlags>::ToIndex(UnitFlags value) { switch (value) { @@ -196,10 +196,10 @@ AC_API_EXPORT EnumText EnumUtils<NPCFlags>::ToString(NPCFlags value) } template <> -AC_API_EXPORT size_t EnumUtils<NPCFlags>::Count() { return 28; } +AC_API_EXPORT std::size_t EnumUtils<NPCFlags>::Count() { return 28; } template <> -AC_API_EXPORT NPCFlags EnumUtils<NPCFlags>::FromIndex(size_t index) +AC_API_EXPORT NPCFlags EnumUtils<NPCFlags>::FromIndex(std::size_t index) { switch (index) { @@ -236,7 +236,7 @@ AC_API_EXPORT NPCFlags EnumUtils<NPCFlags>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<NPCFlags>::ToIndex(NPCFlags value) +AC_API_EXPORT std::size_t EnumUtils<NPCFlags>::ToIndex(NPCFlags value) { switch (value) { diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 458dfcfc3c..2b07f99ba8 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -381,7 +381,7 @@ void ObjectMgr::AddLocaleString(std::string&& s, LocaleConstant locale, std::vec { if (!s.empty()) { - if (data.size() <= size_t(locale)) + if (data.size() <= std::size_t(locale)) data.resize(locale + 1); data[locale] = std::move(s); @@ -5514,9 +5514,9 @@ void ObjectMgr::LoadEventScripts() if (spell->Effects[j].MiscValue) evt_scripts.insert(spell->Effects[j].MiscValue); - for (size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx) + for (std::size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx) { - for (size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx) + for (std::size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx) { TaxiPathNodeEntry const* node = sTaxiPathNodesByPath[path_idx][node_idx]; @@ -8388,7 +8388,7 @@ uint8 ObjectMgr::CheckPlayerName(std::string_view name, bool create) // Check for three consecutive letters wstrToLower(wname); - for (size_t i = 2; i < wname.size(); ++i) + for (std::size_t i = 2; i < wname.size(); ++i) if (wname[i] == wname[i - 1] && wname[i] == wname[i - 2]) return CHAR_NAME_THREE_CONSECUTIVE; @@ -8581,7 +8581,7 @@ char const* ObjectMgr::GetAcoreString(uint32 entry, LocaleConstant locale) const { if (AcoreString const* ts = GetAcoreString(entry)) { - if (ts->Content.size() > size_t(locale) && !ts->Content[locale].empty()) + if (ts->Content.size() > std::size_t(locale) && !ts->Content[locale].empty()) return ts->Content[locale].c_str(); return ts->Content[DEFAULT_LOCALE].c_str(); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 17d6d480f9..de9c44089e 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -458,13 +458,13 @@ struct BroadcastText { if (gender == GENDER_FEMALE && (forceGender || !FemaleText[DEFAULT_LOCALE].empty())) { - if (FemaleText.size() > size_t(locale) && !FemaleText[locale].empty()) + if (FemaleText.size() > std::size_t(locale) && !FemaleText[locale].empty()) return FemaleText[locale]; return FemaleText[DEFAULT_LOCALE]; } // else if (gender == GENDER_MALE) { - if (MaleText.size() > size_t(locale) && !MaleText[locale].empty()) + if (MaleText.size() > std::size_t(locale) && !MaleText[locale].empty()) return MaleText[locale]; return MaleText[DEFAULT_LOCALE]; } @@ -1414,7 +1414,7 @@ public: } static void AddLocaleString(std::string&& s, LocaleConstant locale, std::vector<std::string>& data); - static std::string_view GetLocaleString(std::vector<std::string> const& data, size_t locale) + static std::string_view GetLocaleString(std::vector<std::string> const& data, std::size_t locale) { if (locale < data.size()) return data[locale]; @@ -1423,7 +1423,7 @@ public: } static inline void GetLocaleString(const std::vector<std::string>& data, int loc_idx, std::string& value) { - if (data.size() > size_t(loc_idx) && !data[loc_idx].empty()) + if (data.size() > std::size_t(loc_idx) && !data[loc_idx].empty()) value = data[loc_idx]; } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index c6ec70d1bc..3440bf8aff 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -1709,7 +1709,7 @@ namespace Acore ~LocalizedPacketDo() { - for (size_t i = 0; i < i_data_cache.size(); ++i) + for (std::size_t i = 0; i < i_data_cache.size(); ++i) delete i_data_cache[i]; } void operator()(Player* p); @@ -1729,8 +1729,8 @@ namespace Acore ~LocalizedPacketListDo() { - for (size_t i = 0; i < i_data_cache.size(); ++i) - for (size_t j = 0; j < i_data_cache[i].size(); ++j) + for (std::size_t i = 0; i < i_data_cache.size(); ++i) + for (std::size_t j = 0; j < i_data_cache[i].size(); ++j) delete i_data_cache[i][j]; } void operator()(Player* p); diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h index 3cd1b77dcf..bc5e8e2fa2 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h +++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h @@ -580,7 +580,7 @@ void Acore::LocalizedPacketListDo<Builder>::operator()(Player* p) else data_list = &i_data_cache[cache_idx]; - for (size_t i = 0; i < data_list->size(); ++i) + for (std::size_t i = 0; i < data_list->size(); ++i) p->SendDirectMessage((*data_list)[i]); } diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 43b8d5c6f4..8cf5dda046 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -1024,7 +1024,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData) data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION uint64 auraMask = 0; - size_t maskPos = data.wpos(); + std::size_t maskPos = data.wpos(); data << uint64(auraMask); // placeholder for (uint8 i = 0; i < MAX_AURAS_GROUP_UPDATE; ++i) { diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 7307b6e8f4..afe228b4e1 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -1074,7 +1074,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry) WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + itemCount * 8 * 4); data << vendorGuid; - size_t countPos = data.wpos(); + std::size_t countPos = data.wpos(); data << uint8(count); float discountMod = _player->GetReputationPriceDiscount(vendor); diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 9c71d98bc7..ab9179d61d 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -660,7 +660,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData) uint8 item_count = uint8(mail->items.size()); // max count is MAX_MAIL_ITEMS (12) - size_t next_mail_size = 2 + 4 + 1 + (mail->messageType == MAIL_NORMAL ? 8 : 4) + 4 * 8 + (mail->subject.size() + 1) + (mail->body.size() + 1) + 1 + item_count * (1 + 4 + 4 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3 * 4 + 4 + 4 + 4 + 4 + 4 + 4 + 1); + std::size_t next_mail_size = 2 + 4 + 1 + (mail->messageType == MAIL_NORMAL ? 8 : 4) + 4 * 8 + (mail->subject.size() + 1) + (mail->body.size() + 1) + 1 + item_count * (1 + 4 + 4 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3 * 4 + 4 + 4 + 4 + 4 + 4 + 4 + 1); if (data.wpos() + next_mail_size > MAX_NETCLIENT_PACKET_SIZE) { diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 237ccf1661..b226b9ed0e 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -124,7 +124,7 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) data << guid; data << uint32(trainer_spells->trainerType); - size_t count_pos = data.wpos(); + std::size_t count_pos = data.wpos(); data << uint32(trainer_spells->spellList.size()); // reputation discount @@ -483,7 +483,7 @@ void WorldSession::SendStablePet(ObjectGuid guid) WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size data << guid; - size_t wpos = data.wpos(); + std::size_t wpos = data.wpos(); data << uint8(0); // place holder for slot show number PetStable* petStable = GetPlayer()->GetPetStable(); diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index f38df27fc0..0e718484b7 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -149,10 +149,10 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) CreatureQuestItemList const* items = sObjectMgr->GetCreatureQuestItemList(entry); if (items) - for (size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) + for (std::size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) data << (i < items->size() ? uint32((*items)[i]) : uint32(0)); else - for (size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) + for (std::size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) data << uint32(0); data << uint32(ci->movementId); // CreatureMovementInfo.dbc @@ -210,10 +210,10 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) GameObjectQuestItemList const* items = sObjectMgr->GetGameObjectQuestItemList(entry); if (items) - for (size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i) + for (std::size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i) data << (i < items->size() ? uint32((*items)[i]) : uint32(0)); else - for (size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i) + for (std::size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i) data << uint32(0); SendPacket(&data); diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 18ce2e57d1..c9555f414c 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -641,7 +641,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket void WorldSession::HandleQueryQuestsCompleted(WorldPacket& /*recvData*/) { - size_t rew_count = _player->GetRewardedQuestCount(); + std::size_t rew_count = _player->GetRewardedQuestCount(); WorldPacket data(SMSG_QUERY_QUESTS_COMPLETED_RESPONSE, 4 + 4 * rew_count); data << uint32(rew_count); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 5284e55549..d85a491948 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1007,7 +1007,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) b << uint32(l.gold); //gold - size_t count_pos = b.wpos(); // pos of item count byte + std::size_t count_pos = b.wpos(); // pos of item count byte b << uint8(0); // item count placeholder switch (lv.permission) @@ -1546,7 +1546,7 @@ LootTemplate::~LootTemplate() Entries.pop_back(); } - for (size_t i = 0; i < Groups.size(); ++i) + for (std::size_t i = 0; i < Groups.size(); ++i) delete Groups[i]; Groups.clear(); } diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 168d54111f..c4410d3843 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -651,7 +651,7 @@ public: _updateObjects.erase(obj); } - size_t GetActiveNonPlayersCount() const + std::size_t GetActiveNonPlayersCount() const { return m_activeNonPlayers.size(); } diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp index 952ee87511..552b48d7e3 100644 --- a/src/server/game/Maps/MapUpdater.cpp +++ b/src/server/game/Maps/MapUpdater.cpp @@ -71,10 +71,10 @@ MapUpdater::MapUpdater(): pending_requests(0) { } -void MapUpdater::activate(size_t num_threads) +void MapUpdater::activate(std::size_t num_threads) { _workerThreads.reserve(num_threads); - for (size_t i = 0; i < num_threads; ++i) + for (std::size_t i = 0; i < num_threads; ++i) { _workerThreads.push_back(std::thread(&MapUpdater::WorkerThread, this)); } diff --git a/src/server/game/Maps/MapUpdater.h b/src/server/game/Maps/MapUpdater.h index 59b4f0e1a5..617e1c5364 100644 --- a/src/server/game/Maps/MapUpdater.h +++ b/src/server/game/Maps/MapUpdater.h @@ -36,7 +36,7 @@ public: void schedule_update(Map& map, uint32 diff, uint32 s_diff); void schedule_lfg_update(uint32 diff); void wait(); - void activate(size_t num_threads); + void activate(std::size_t num_threads); void deactivate(); bool activated(); void update_finished(); @@ -51,7 +51,7 @@ private: std::mutex _lock; std::condition_variable _condition; - size_t pending_requests; + std::size_t pending_requests; }; #endif //_MAP_UPDATER_H_INCLUDED diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index e6ad171d38..faeef233e8 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -25,7 +25,7 @@ TransportTemplate::~TransportTemplate() { // Collect shared pointers into a set to avoid deleting the same memory more than once std::set<TransportSpline*> splines; - for (size_t i = 0; i < keyFrames.size(); ++i) + for (std::size_t i = 0; i < keyFrames.size(); ++i) splines.insert(keyFrames[i].Spline); for (std::set<TransportSpline*>::iterator itr = splines.begin(); itr != splines.end(); ++itr) @@ -118,7 +118,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl std::vector<KeyFrame>& keyFrames = transport->keyFrames; Movement::PointsArray splinePath, allPoints; bool mapChange = false; - for (size_t i = 0; i < path.size(); ++i) + for (std::size_t i = 0; i < path.size(); ++i) allPoints.push_back(G3D::Vector3(path[i]->x, path[i]->y, path[i]->z)); // Add extra points to allow derivative calculations for all path nodes @@ -131,7 +131,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl orientationSpline.init_spline_custom(initer); orientationSpline.initLengths(); - for (size_t i = 0; i < path.size(); ++i) + for (std::size_t i = 0; i < path.size(); ++i) { if (!mapChange) { @@ -208,16 +208,16 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl // find the rest of the distances between key points // Every path segment has its own spline - size_t start = 0; - for (size_t i = 1; i < keyFrames.size(); ++i) + std::size_t start = 0; + for (std::size_t i = 1; i < keyFrames.size(); ++i) { if (keyFrames[i - 1].Teleport || i + 1 == keyFrames.size()) { - size_t extra = !keyFrames[i - 1].Teleport ? 1 : 0; + std::size_t extra = !keyFrames[i - 1].Teleport ? 1 : 0; TransportSpline* spline = new TransportSpline(); spline->init_spline(&splinePath[start], i - start + extra, Movement::SplineBase::ModeCatmullrom); spline->initLengths(); - for (size_t j = start; j < i + extra; ++j) + for (std::size_t j = start; j < i + extra; ++j) { keyFrames[j].Index = j - start + 1; keyFrames[j].DistFromPrev = spline->length(j - start, j + 1 - start); @@ -255,7 +255,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl // and distUntilStop is to the next stopping keyframe. // this is required to properly handle cases of two stopping frames in a row (yes they do exist) float tmpDist = 0.0f; - for (size_t i = 0; i < keyFrames.size(); ++i) + for (std::size_t i = 0; i < keyFrames.size(); ++i) { int32 j = (i + lastStop) % keyFrames.size(); if (keyFrames[j].IsStopFrame() || j == lastStop) @@ -275,7 +275,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl tmpDist = 0.0f; } - for (size_t i = 0; i < keyFrames.size(); ++i) + for (std::size_t i = 0; i < keyFrames.size(); ++i) { float total_dist = keyFrames[i].DistSinceStop + keyFrames[i].DistUntilStop; if (total_dist < 2 * accel_dist) // won't reach full speed @@ -305,7 +305,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl // calculate tFrom times from tTo times float segmentTime = 0.0f; - for (size_t i = 0; i < keyFrames.size(); ++i) + for (std::size_t i = 0; i < keyFrames.size(); ++i) { int32 j = (i + lastStop) % keyFrames.size(); if (keyFrames[j].IsStopFrame() || j == lastStop) @@ -322,7 +322,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl keyFrames[0].DepartureTime = uint32(curPathTime * IN_MILLISECONDS); } - for (size_t i = 1; i < keyFrames.size(); ++i) + for (std::size_t i = 1; i < keyFrames.size(); ++i) { curPathTime += keyFrames[i - 1].TimeTo; if (keyFrames[i].IsStopFrame()) diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 785b48baf7..d17cef553c 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -121,7 +121,7 @@ void MotionMaster::UpdateMotion(uint32 diff) if (_expList) { - for (size_t i = 0; i < _expList->size(); ++i) + for (std::size_t i = 0; i < _expList->size(); ++i) { MovementGenerator* mg = (*_expList)[i]; DirectDelete(mg); diff --git a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp index 0a8bbb5660..ebe4934f8a 100644 --- a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp @@ -1038,7 +1038,7 @@ void PathGenerator::ShortenPathUntilDist(G3D::Vector3 const& target, float dist) if ((*_pathPoints.rbegin() - target).squaredLength() >= distSq) return; - size_t i = _pathPoints.size() - 1; + std::size_t i = _pathPoints.size() - 1; float x, y, z, collisionHeight = _source->GetCollisionHeight(); // find the first i s.t.: // - _pathPoints[i] is still too close diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 449dafaf06..d06f9bb3ee 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -500,7 +500,7 @@ void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() } uint32 map0 = i_path[i_currentNode]->mapid; - for (size_t i = i_currentNode + 1; i < i_path.size(); ++i) + for (std::size_t i = i_currentNode + 1; i < i_path.size(); ++i) { if (i_path[i]->mapid != map0) { diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h index a0d26fd54f..68ad95b142 100644 --- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h +++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h @@ -43,7 +43,7 @@ namespace Movement struct MoveSplineInitArgs { - MoveSplineInitArgs(size_t path_capacity = 16) + MoveSplineInitArgs(std::size_t path_capacity = 16) { path.reserve(path_capacity); } diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 703a79dde2..247cbf3437 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -158,7 +158,7 @@ bool PoolGroup<T>::CheckPool() const template<class T> void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, ObjectGuid::LowType guid) { - for (size_t i = 0; i < EqualChanced.size(); ++i) + for (std::size_t i = 0; i < EqualChanced.size(); ++i) { // if spawned if (spawns.IsActiveObject<T>(EqualChanced[i].guid)) @@ -171,7 +171,7 @@ void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, ObjectGuid::LowType gui } } - for (size_t i = 0; i < ExplicitlyChanced.size(); ++i) + for (std::size_t i = 0; i < ExplicitlyChanced.size(); ++i) { // spawned if (spawns.IsActiveObject<T>(ExplicitlyChanced[i].guid)) diff --git a/src/server/game/Quests/enuminfo_QuestDef.cpp b/src/server/game/Quests/enuminfo_QuestDef.cpp index aec7b5de36..6fbf2beb9c 100644 --- a/src/server/game/Quests/enuminfo_QuestDef.cpp +++ b/src/server/game/Quests/enuminfo_QuestDef.cpp @@ -49,10 +49,10 @@ AC_API_EXPORT EnumText EnumUtils<QuestFailedReason>::ToString(QuestFailedReason } template <> -AC_API_EXPORT size_t EnumUtils<QuestFailedReason>::Count() { return 13; } +AC_API_EXPORT std::size_t EnumUtils<QuestFailedReason>::Count() { return 13; } template <> -AC_API_EXPORT QuestFailedReason EnumUtils<QuestFailedReason>::FromIndex(size_t index) +AC_API_EXPORT QuestFailedReason EnumUtils<QuestFailedReason>::FromIndex(std::size_t index) { switch (index) { @@ -74,7 +74,7 @@ AC_API_EXPORT QuestFailedReason EnumUtils<QuestFailedReason>::FromIndex(size_t i } template <> -AC_API_EXPORT size_t EnumUtils<QuestFailedReason>::ToIndex(QuestFailedReason value) +AC_API_EXPORT std::size_t EnumUtils<QuestFailedReason>::ToIndex(QuestFailedReason value) { switch (value) { @@ -119,10 +119,10 @@ AC_API_EXPORT EnumText EnumUtils<QuestShareMessages>::ToString(QuestShareMessage } template <> -AC_API_EXPORT size_t EnumUtils<QuestShareMessages>::Count() { return 11; } +AC_API_EXPORT std::size_t EnumUtils<QuestShareMessages>::Count() { return 11; } template <> -AC_API_EXPORT QuestShareMessages EnumUtils<QuestShareMessages>::FromIndex(size_t index) +AC_API_EXPORT QuestShareMessages EnumUtils<QuestShareMessages>::FromIndex(std::size_t index) { switch (index) { @@ -142,7 +142,7 @@ AC_API_EXPORT QuestShareMessages EnumUtils<QuestShareMessages>::FromIndex(size_t } template <> -AC_API_EXPORT size_t EnumUtils<QuestShareMessages>::ToIndex(QuestShareMessages value) +AC_API_EXPORT std::size_t EnumUtils<QuestShareMessages>::ToIndex(QuestShareMessages value) { switch (value) { diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index b749e267fb..497d5078e0 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -184,7 +184,7 @@ void ReputationMgr::SendState(FactionState const* faction) data << uint8(_sendFactionIncreased); _sendFactionIncreased = false; // Reset - size_t p_count = data.wpos(); + std::size_t p_count = data.wpos(); data << uint32(count); data << uint32(faction->ReputationListID); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 15fb7d4faf..eed0d2f20a 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -530,7 +530,7 @@ public: /* GlobalScript */ public: /* Scheduled scripts */ uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; } uint32 DecreaseScheduledScriptCount() { return --_scheduledScripts; } - uint32 DecreaseScheduledScriptCount(size_t count) { return _scheduledScripts -= count; } + uint32 DecreaseScheduledScriptCount(std::size_t count) { return _scheduledScripts -= count; } bool IsScriptScheduled() const { return _scheduledScripts > 0; } public: /* UnitScript */ @@ -796,7 +796,7 @@ public: if (oldScript) { for (auto& vIt : EnabledHooks) - for (size_t i = 0; i < vIt.size(); ++i) + for (std::size_t i = 0; i < vIt.size(); ++i) if (vIt[i] == oldScript) { vIt.erase(vIt.begin() + i); diff --git a/src/server/game/Server/Packet.cpp b/src/server/game/Server/Packet.cpp index e0fea0b79b..47d4e4fbec 100644 --- a/src/server/game/Server/Packet.cpp +++ b/src/server/game/Server/Packet.cpp @@ -22,7 +22,7 @@ WorldPackets::Packet::Packet(WorldPacket&& worldPacket) : _worldPacket(std::move { } -WorldPackets::ServerPacket::ServerPacket(OpcodeServer opcode, size_t initialSize /*= 200*/) : Packet(WorldPacket(opcode, initialSize)) +WorldPackets::ServerPacket::ServerPacket(OpcodeServer opcode, std::size_t initialSize /*= 200*/) : Packet(WorldPacket(opcode, initialSize)) { } diff --git a/src/server/game/Server/Packet.h b/src/server/game/Server/Packet.h index f4c3c8ce90..0bb5664ae8 100644 --- a/src/server/game/Server/Packet.h +++ b/src/server/game/Server/Packet.h @@ -36,7 +36,7 @@ namespace WorldPackets virtual void Read() = 0; [[nodiscard]] WorldPacket const* GetRawPacket() const { return &_worldPacket; } - [[nodiscard]] size_t GetSize() const { return _worldPacket.size(); } + [[nodiscard]] std::size_t GetSize() const { return _worldPacket.size(); } protected: WorldPacket _worldPacket; @@ -45,7 +45,7 @@ namespace WorldPackets class AC_GAME_API ServerPacket : public Packet { public: - ServerPacket(OpcodeServer opcode, size_t initialSize = 200); + ServerPacket(OpcodeServer opcode, std::size_t initialSize = 200); void Read() final; diff --git a/src/server/game/Server/WorldPacket.h b/src/server/game/Server/WorldPacket.h index f2a6933d50..370446b2d4 100644 --- a/src/server/game/Server/WorldPacket.h +++ b/src/server/game/Server/WorldPacket.h @@ -29,7 +29,7 @@ public: // just container for later use WorldPacket() : ByteBuffer(0) { } - explicit WorldPacket(uint16 opcode, size_t res = 200) : + explicit WorldPacket(uint16 opcode, std::size_t res = 200) : ByteBuffer(res), m_opcode(opcode) { } WorldPacket(WorldPacket&& packet) noexcept : @@ -66,7 +66,7 @@ public: WorldPacket(uint16 opcode, MessageBuffer&& buffer) : ByteBuffer(std::move(buffer)), m_opcode(opcode) { } - void Initialize(uint16 opcode, size_t newres = 200) + void Initialize(uint16 opcode, std::size_t newres = 200) { clear(); _storage.reserve(newres); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 7476ce1df7..cc3a0c9110 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -46,13 +46,14 @@ #include "Tokenize.h" #include "Transport.h" #include "Vehicle.h" -#include "WardenMac.h" #include "WardenWin.h" #include "World.h" #include "WorldPacket.h" #include "WorldSocket.h" #include <zlib.h> +#include "BanMgr.h" + namespace { std::string const DefaultPlayerName = "<none>"; diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 596214e29b..52f3e94259 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -25,7 +25,6 @@ #include "AccountMgr.h" #include "AddonMgr.h" #include "AuthDefines.h" -#include "BanMgr.h" #include "CircularBuffer.h" #include "Common.h" #include "DatabaseEnv.h" @@ -34,6 +33,7 @@ #include "SharedDefines.h" #include "World.h" #include <map> +#include <memory> #include <utility> class Creature; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index bd9506c059..4a6e43f56f 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5002,7 +5002,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) // correct count for both hit and miss). uint32 hit = 0; - size_t hitPos = data->wpos(); + std::size_t hitPos = data->wpos(); *data << (uint8)0; // placeholder for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit < 255; ++ihit) { @@ -5022,7 +5022,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) } uint32 miss = 0; - size_t missPos = data->wpos(); + std::size_t missPos = data->wpos(); *data << (uint8)0; // placeholder for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss < 255; ++ihit) { diff --git a/src/server/game/Texts/ChatTextBuilder.cpp b/src/server/game/Texts/ChatTextBuilder.cpp index 79f27913c4..dff037a0b9 100644 --- a/src/server/game/Texts/ChatTextBuilder.cpp +++ b/src/server/game/Texts/ChatTextBuilder.cpp @@ -26,7 +26,7 @@ void Acore::BroadcastTextBuilder::operator()(WorldPacket& data, LocaleConstant l ChatHandler::BuildChatPacket(data, _msgType, bct ? Language(bct->LanguageID) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale); } -size_t Acore::BroadcastTextBuilder::operator()(WorldPacket* data, LocaleConstant locale) const +std::size_t Acore::BroadcastTextBuilder::operator()(WorldPacket* data, LocaleConstant locale) const { BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId); return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->LanguageID) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale); @@ -47,7 +47,7 @@ void Acore::AcoreStringChatBuilder::operator()(WorldPacket& data, LocaleConstant va_list ap; va_copy(ap, *_args); - static size_t const BufferSize = 2048; + static std::size_t const BufferSize = 2048; char strBuffer[BufferSize]; vsnprintf(strBuffer, BufferSize, text, ap); va_end(ap); diff --git a/src/server/game/Texts/ChatTextBuilder.h b/src/server/game/Texts/ChatTextBuilder.h index ec1fce7d72..724f9f7b22 100644 --- a/src/server/game/Texts/ChatTextBuilder.h +++ b/src/server/game/Texts/ChatTextBuilder.h @@ -34,7 +34,7 @@ namespace Acore : _source(obj), _msgType(msgType), _textId(textId), _gender(gender), _target(target), _achievementId(achievementId) { } void operator()(WorldPacket& data, LocaleConstant locale) const; - size_t operator()(WorldPacket* data, LocaleConstant locale) const; + std::size_t operator()(WorldPacket* data, LocaleConstant locale) const; private: WorldObject const* _source; diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index f370e72ab1..78fd3ce633 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -31,7 +31,7 @@ public: CreatureTextBuilder(WorldObject* obj, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target) : _source(obj), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { } - size_t operator()(WorldPacket* data, LocaleConstant locale) const + std::size_t operator()(WorldPacket* data, LocaleConstant locale) const { std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale); @@ -54,7 +54,7 @@ public: PlayerTextBuilder(WorldObject* obj, WorldObject* speaker, uint8 gender, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, WorldObject const* target) : _source(obj), _talker(speaker), _gender(gender), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _target(target) { } - size_t operator()(WorldPacket* data, LocaleConstant locale) const + std::size_t operator()(WorldPacket* data, LocaleConstant locale) const { std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _gender, _textGroup, _textId, locale); diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index e6342eb0dc..c90a6300e3 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -129,7 +129,7 @@ public: ~CreatureTextLocalizer() { - for (size_t i = 0; i < _packetCache.size(); ++i) + for (std::size_t i = 0; i < _packetCache.size(); ++i) { if (_packetCache[i]) delete _packetCache[i]->first; @@ -141,14 +141,14 @@ public: { LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); WorldPacket* messageTemplate; - size_t whisperGUIDpos; + std::size_t whisperGUIDpos; // create if not cached yet if (!_packetCache[loc_idx]) { messageTemplate = new WorldPacket(); whisperGUIDpos = _builder(messageTemplate, loc_idx); - _packetCache[loc_idx] = new std::pair<WorldPacket*, size_t>(messageTemplate, whisperGUIDpos); + _packetCache[loc_idx] = new std::pair<WorldPacket*, std::size_t>(messageTemplate, whisperGUIDpos); } else { @@ -171,7 +171,7 @@ public: } private: - std::vector<std::pair<WorldPacket*, size_t>* > _packetCache; + std::vector<std::pair<WorldPacket*, std::size_t>* > _packetCache; Builder const& _builder; ChatMsg _msgType; }; diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 9b19143ac8..e4d2d94df3 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -138,14 +138,14 @@ void GmTicket::SendResponse(WorldSession* session) const data << uint32(_id); // ticketID data << _message.c_str(); - size_t len = _response.size(); + std::size_t len = _response.size(); char const* s = _response.c_str(); for (int i = 0; i < 4; i++) { if (len) { - size_t writeLen = std::min<size_t>(len, 3999); + std::size_t writeLen = std::min<size_t>(len, 3999); data.append(s, writeLen); len -= writeLen; diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index f1e4cb388a..96f066a9ea 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -426,7 +426,7 @@ inline std::string GetTableName(std::string const& str) return str.substr(s, e - s); } -inline bool ValidateFields(TableStruct const& ts, std::string const& str, size_t lineNumber) +inline bool ValidateFields(TableStruct const& ts, std::string const& str, std::size_t lineNumber) { std::string::size_type s = str.find("` VALUES ("); if (s != std::string::npos) // old dump format (no column names) @@ -753,7 +753,7 @@ DumpReturn PlayerDumpWriter::WriteDumpToString(std::string& dump, ObjectGuid::Lo inline void FixNULLfields(std::string& line) { static std::string const NullString("'NULL'"); - size_t pos = line.find(NullString); + std::size_t pos = line.find(NullString); while (pos != std::string::npos) { line.replace(pos, NullString.length(), "NULL"); @@ -823,7 +823,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::istream& input, uint32 account, std:: uint8 level = 1; // for logs - size_t lineNumber = 0; + std::size_t lineNumber = 0; CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); while (std::getline(input, line)) @@ -831,7 +831,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::istream& input, uint32 account, std:: ++lineNumber; // skip empty strings - size_t nw_pos = line.find_first_not_of(" \t\n\r\7"); + std::size_t nw_pos = line.find_first_not_of(" \t\n\r\7"); if (nw_pos == std::string::npos) continue; diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index af37fab2bf..298264e469 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -168,7 +168,7 @@ union keyData uint32 Warden::BuildChecksum(const uint8* data, uint32 length) { keyData hash{}; - hash.bytes = Acore::Crypto::SHA1::GetDigestOf(data, size_t(length)); + hash.bytes = Acore::Crypto::SHA1::GetDigestOf(data, std::size_t(length)); uint32 checkSum = 0; for (uint8 i = 0; i < 5; ++i) diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index c10ce9a3b5..53883f18cc 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -17,6 +17,7 @@ #include "WardenMac.h" #include "ByteBuffer.h" +#include "CryptoHash.h" #include "Log.h" #include "Opcodes.h" #include "Player.h" diff --git a/src/server/game/Warden/WardenPayloadMgr.cpp b/src/server/game/Warden/WardenPayloadMgr.cpp index 9245bd9e53..4f88f18913 100644 --- a/src/server/game/Warden/WardenPayloadMgr.cpp +++ b/src/server/game/Warden/WardenPayloadMgr.cpp @@ -128,7 +128,7 @@ void WardenPayloadMgr::QueuePayload(uint16 payloadId, bool pushToFront) bool WardenPayloadMgr::DequeuePayload(uint16 payloadId) { - size_t const queueSize = QueuedPayloads.size(); + std::size_t const queueSize = QueuedPayloads.size(); QueuedPayloads.remove(payloadId); return queueSize != QueuedPayloads.size(); diff --git a/src/server/game/Warden/enuminfo_WardenCheckMgr.cpp b/src/server/game/Warden/enuminfo_WardenCheckMgr.cpp index f76872a822..61bd60f377 100644 --- a/src/server/game/Warden/enuminfo_WardenCheckMgr.cpp +++ b/src/server/game/Warden/enuminfo_WardenCheckMgr.cpp @@ -39,10 +39,10 @@ AC_API_EXPORT EnumText EnumUtils<WardenActions>::ToString(WardenActions value) } template <> -AC_API_EXPORT size_t EnumUtils<WardenActions>::Count() { return 3; } +AC_API_EXPORT std::size_t EnumUtils<WardenActions>::Count() { return 3; } template <> -AC_API_EXPORT WardenActions EnumUtils<WardenActions>::FromIndex(size_t index) +AC_API_EXPORT WardenActions EnumUtils<WardenActions>::FromIndex(std::size_t index) { switch (index) { @@ -54,7 +54,7 @@ AC_API_EXPORT WardenActions EnumUtils<WardenActions>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<WardenActions>::ToIndex(WardenActions value) +AC_API_EXPORT std::size_t EnumUtils<WardenActions>::ToIndex(WardenActions value) { switch (value) { diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 93092d9b2b..9e908b6326 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -138,7 +138,7 @@ public: // store random suggested secrets static std::unordered_map<uint32, Acore::Crypto::TOTP::Secret> suggestions; - auto pair = suggestions.emplace(std::piecewise_construct, std::make_tuple(accountId), std::make_tuple(Acore::Crypto::TOTP::RECOMMENDED_SECRET_LENGTH)); // std::vector 1-argument size_t constructor invokes resize + auto pair = suggestions.emplace(std::piecewise_construct, std::make_tuple(accountId), std::make_tuple(Acore::Crypto::TOTP::RECOMMENDED_SECRET_LENGTH)); // std::vector 1-argument std::size_t constructor invokes resize if (pair.second) // no suggestion yet, generate random secret Acore::Crypto::GetRandomBytes(pair.first->second); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 242866a20a..1c9afabda8 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -694,7 +694,7 @@ public: if (!p->IsGameMaster()) targetList.push_back(p); - size_t half = targetList.size() / 2; + std::size_t half = targetList.size() / 2; // half gets ooze variable while (half < targetList.size()) { diff --git a/src/server/shared/DataStores/DBCStore.h b/src/server/shared/DataStores/DBCStore.h index 8b09daee03..b0ab578466 100644 --- a/src/server/shared/DataStores/DBCStore.h +++ b/src/server/shared/DataStores/DBCStore.h @@ -75,7 +75,7 @@ public: { // Resize typedef char* ptr; - size_t newSize = id + 1; + std::size_t newSize = id + 1; ptr* newArr = new ptr[newSize]; memset(newArr, 0, newSize * sizeof(ptr)); memcpy(newArr, _indexTable.AsChar, _indexTableSize * sizeof(ptr)); diff --git a/src/server/shared/DataStores/DBCStructure.h b/src/server/shared/DataStores/DBCStructure.h index b3d08a9498..6dfcadb486 100644 --- a/src/server/shared/DataStores/DBCStructure.h +++ b/src/server/shared/DataStores/DBCStructure.h @@ -2245,7 +2245,7 @@ typedef std::map<uint32, TaxiPathSetForSource> TaxiPathSetBySource; typedef std::vector<TaxiPathNodeEntry const*> TaxiPathNodeList; typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath; -static constexpr size_t TaxiMaskSize = 14; +static constexpr std::size_t TaxiMaskSize = 14; typedef std::array<uint32, TaxiMaskSize> TaxiMask; #endif diff --git a/src/server/shared/Network/NetworkThread.h b/src/server/shared/Network/NetworkThread.h index d71cee51fd..12c4ec4e8b 100644 --- a/src/server/shared/Network/NetworkThread.h +++ b/src/server/shared/Network/NetworkThread.h @@ -134,7 +134,7 @@ protected: void HandleNewSocketsProxyReadingOnConnect() { - size_t index = 0; + std::size_t index = 0; std::vector<int> newSocketsToRemoveIndexes; for (auto sock_iter = _newSockets.begin(); sock_iter != _newSockets.end(); ++sock_iter, ++index) { diff --git a/src/server/shared/Network/Socket.h b/src/server/shared/Network/Socket.h index e92f2c42eb..0a431eb4d2 100644 --- a/src/server/shared/Network/Socket.h +++ b/src/server/shared/Network/Socket.h @@ -205,7 +205,7 @@ protected: } private: - void ReadHandlerInternal(boost::system::error_code error, size_t transferredBytes) + void ReadHandlerInternal(boost::system::error_code error, std::size_t transferredBytes) { if (error) { @@ -219,7 +219,7 @@ private: // ProxyReadHeaderHandler reads Proxy Protocol v2 header (v1 is not supported). // See https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt (2.2. Binary header format (version 2)) for more details. - void ProxyReadHeaderHandler(boost::system::error_code error, size_t transferredBytes) + void ProxyReadHeaderHandler(boost::system::error_code error, std::size_t transferredBytes) { if (error) { diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index ce0f85b3ac..dab792c775 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -27,7 +27,7 @@ ByteBuffer::ByteBuffer(MessageBuffer&& buffer) : _rpos(0), _wpos(0), _storage(buffer.Move()) { } -ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize) +ByteBufferPositionException::ByteBufferPositionException(bool add, std::size_t pos, std::size_t size, std::size_t valueSize) { std::ostringstream ss; @@ -38,7 +38,7 @@ ByteBufferPositionException::ByteBufferPositionException(bool add, size_t pos, s message().assign(ss.str()); } -ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size, size_t valueSize) +ByteBufferSourceException::ByteBufferSourceException(std::size_t pos, std::size_t size, std::size_t valueSize) { std::ostringstream ss; @@ -107,13 +107,13 @@ uint32 ByteBuffer::ReadPackedTime() return uint32(mktime(<)); } -void ByteBuffer::append(uint8 const* src, size_t cnt) +void ByteBuffer::append(uint8 const* src, std::size_t cnt) { ASSERT(src, "Attempted to put a NULL-pointer in ByteBuffer (pos: {} size: {})", _wpos, size()); ASSERT(cnt, "Attempted to put a zero-sized value in ByteBuffer (pos: {} size: {})", _wpos, size()); ASSERT(size() < 10000000); - size_t const newSize = _wpos + cnt; + std::size_t const newSize = _wpos + cnt; if (_storage.capacity() < newSize) // custom memory allocation rules { @@ -140,7 +140,7 @@ void ByteBuffer::AppendPackedTime(time_t time) append<uint32>((lt.tm_year - 100) << 24 | lt.tm_mon << 20 | (lt.tm_mday - 1) << 14 | lt.tm_wday << 11 | lt.tm_hour << 6 | lt.tm_min); } -void ByteBuffer::put(size_t pos, uint8 const* src, size_t cnt) +void ByteBuffer::put(std::size_t pos, uint8 const* src, std::size_t cnt) { ASSERT(pos + cnt <= size(), "Attempted to put value with size: {} in ByteBuffer (pos: {} size: {})", cnt, pos, size()); ASSERT(src, "Attempted to put a NULL-pointer in ByteBuffer (pos: {} size: {})", pos, size()); diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 82e8d6521f..308b6d7281 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -45,7 +45,7 @@ private: class AC_SHARED_API ByteBufferPositionException : public ByteBufferException { public: - ByteBufferPositionException(bool add, size_t pos, size_t size, size_t valueSize); + ByteBufferPositionException(bool add, std::size_t pos, std::size_t size, std::size_t valueSize); ~ByteBufferPositionException() noexcept override = default; }; @@ -53,7 +53,7 @@ public: class AC_SHARED_API ByteBufferSourceException : public ByteBufferException { public: - ByteBufferSourceException(size_t pos, size_t size, size_t valueSize); + ByteBufferSourceException(std::size_t pos, std::size_t size, std::size_t valueSize); ~ByteBufferSourceException() noexcept override = default; }; @@ -211,7 +211,7 @@ public: ByteBuffer& operator<<(std::string_view value) { - if (size_t len = value.length()) + if (std::size_t len = value.length()) { append(reinterpret_cast<uint8 const*>(value.data()), len); } @@ -294,7 +294,7 @@ public: return *this; } - uint8& operator[](size_t const pos) + uint8& operator[](std::size_t const pos) { if (pos >= size()) { @@ -304,7 +304,7 @@ public: return _storage[pos]; } - uint8 const& operator[](size_t const pos) const + uint8 const& operator[](std::size_t const pos) const { if (pos >= size()) { @@ -314,9 +314,9 @@ public: return _storage[pos]; } - [[nodiscard]] size_t rpos() const { return _rpos; } + [[nodiscard]] std::size_t rpos() const { return _rpos; } - size_t rpos(size_t rpos_) + std::size_t rpos(std::size_t rpos_) { _rpos = rpos_; return _rpos; @@ -327,9 +327,9 @@ public: _rpos = wpos(); } - [[nodiscard]] size_t wpos() const { return _wpos; } + [[nodiscard]] std::size_t wpos() const { return _wpos; } - size_t wpos(size_t wpos_) + std::size_t wpos(std::size_t wpos_) { _wpos = wpos_; return _wpos; @@ -338,7 +338,7 @@ public: template<typename T> void read_skip() { read_skip(sizeof(T)); } - void read_skip(size_t skip) + void read_skip(std::size_t skip) { if (_rpos + skip > size()) { @@ -355,7 +355,7 @@ public: return r; } - template <typename T> [[nodiscard]] T read(size_t pos) const + template <typename T> [[nodiscard]] T read(std::size_t pos) const { if (pos + sizeof(T) > size()) { @@ -367,7 +367,7 @@ public: return val; } - void read(uint8* dest, size_t len) + void read(uint8* dest, std::size_t len) { if (_rpos + len > size()) { @@ -378,7 +378,7 @@ public: _rpos += len; } - template <size_t Size> + template <std::size_t Size> void read(std::array<uint8, Size>& arr) { read(arr.data(), Size); @@ -441,17 +441,17 @@ public: return _storage.data(); } - [[nodiscard]] size_t size() const { return _storage.size(); } + [[nodiscard]] std::size_t size() const { return _storage.size(); } [[nodiscard]] bool empty() const { return _storage.empty(); } - void resize(size_t newsize) + void resize(std::size_t newsize) { _storage.resize(newsize, 0); _rpos = 0; _wpos = size(); } - void reserve(size_t ressize) + void reserve(std::size_t ressize) { if (ressize > size()) { @@ -464,17 +464,17 @@ public: _storage.shrink_to_fit(); } - void append(const char *src, size_t cnt) + void append(const char *src, std::size_t cnt) { return append((const uint8 *)src, cnt); } - template<class T> void append(const T* src, size_t cnt) + template<class T> void append(const T* src, std::size_t cnt) { return append((const uint8*)src, cnt * sizeof(T)); } - void append(uint8 const* src, size_t cnt); + void append(uint8 const* src, std::size_t cnt); void append(ByteBuffer const& buffer) { @@ -484,7 +484,7 @@ public: } } - template <size_t Size> + template <std::size_t Size> void append(std::array<uint8, Size> const& arr) { append(arr.data(), Size); @@ -504,7 +504,7 @@ public: { uint8 packGUID[8 + 1]; packGUID[0] = 0; - size_t size = 1; + std::size_t size = 1; for (uint8 i = 0; guid != 0;++i) { @@ -522,13 +522,13 @@ public: } void AppendPackedTime(time_t time); - void put(size_t pos, const uint8 *src, size_t cnt); + void put(std::size_t pos, const uint8 *src, std::size_t cnt); void print_storage() const; void textlike() const; void hexlike() const; protected: - size_t _rpos{0}, _wpos{0}; + std::size_t _rpos{0}, _wpos{0}; std::vector<uint8> _storage; }; diff --git a/src/server/shared/Realms/Realm.h b/src/server/shared/Realms/Realm.h index 10e8f88ec1..f3b0d78994 100644 --- a/src/server/shared/Realms/Realm.h +++ b/src/server/shared/Realms/Realm.h @@ -20,6 +20,7 @@ #include "AsioHacksFwd.h" #include "Common.h" +#include <memory> enum RealmFlags { diff --git a/src/server/shared/SharedDefines.h b/src/server/shared/SharedDefines.h index 1b0568fe6c..241f4ac5da 100644 --- a/src/server/shared/SharedDefines.h +++ b/src/server/shared/SharedDefines.h @@ -362,7 +362,7 @@ const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = 0xffe6cc80 //LIGHT YELLOW }; -size_t constexpr MAX_QUEST_DIFFICULTY = 5; +std::size_t constexpr MAX_QUEST_DIFFICULTY = 5; uint32 constexpr QuestDifficultyColors[MAX_QUEST_DIFFICULTY] = { 0xff40c040, diff --git a/src/server/shared/enuminfo_SharedDefines.cpp b/src/server/shared/enuminfo_SharedDefines.cpp index d75cdf89fa..e5ae568ddd 100644 --- a/src/server/shared/enuminfo_SharedDefines.cpp +++ b/src/server/shared/enuminfo_SharedDefines.cpp @@ -46,10 +46,10 @@ AC_API_EXPORT EnumText EnumUtils<Races>::ToString(Races value) } template <> -AC_API_EXPORT size_t EnumUtils<Races>::Count() { return 10; } +AC_API_EXPORT std::size_t EnumUtils<Races>::Count() { return 10; } template <> -AC_API_EXPORT Races EnumUtils<Races>::FromIndex(size_t index) +AC_API_EXPORT Races EnumUtils<Races>::FromIndex(std::size_t index) { switch (index) { @@ -68,7 +68,7 @@ AC_API_EXPORT Races EnumUtils<Races>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<Races>::ToIndex(Races value) +AC_API_EXPORT std::size_t EnumUtils<Races>::ToIndex(Races value) { switch (value) { @@ -109,10 +109,10 @@ AC_API_EXPORT EnumText EnumUtils<Classes>::ToString(Classes value) } template <> -AC_API_EXPORT size_t EnumUtils<Classes>::Count() { return 10; } +AC_API_EXPORT std::size_t EnumUtils<Classes>::Count() { return 10; } template <> -AC_API_EXPORT Classes EnumUtils<Classes>::FromIndex(size_t index) +AC_API_EXPORT Classes EnumUtils<Classes>::FromIndex(std::size_t index) { switch (index) { @@ -131,7 +131,7 @@ AC_API_EXPORT Classes EnumUtils<Classes>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<Classes>::ToIndex(Classes value) +AC_API_EXPORT std::size_t EnumUtils<Classes>::ToIndex(Classes value) { switch (value) { @@ -194,10 +194,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr0>::ToString(SpellAttr0 value) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr0>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<SpellAttr0>::Count() { return 32; } template <> -AC_API_EXPORT SpellAttr0 EnumUtils<SpellAttr0>::FromIndex(size_t index) +AC_API_EXPORT SpellAttr0 EnumUtils<SpellAttr0>::FromIndex(std::size_t index) { switch (index) { @@ -238,7 +238,7 @@ AC_API_EXPORT SpellAttr0 EnumUtils<SpellAttr0>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr0>::ToIndex(SpellAttr0 value) +AC_API_EXPORT std::size_t EnumUtils<SpellAttr0>::ToIndex(SpellAttr0 value) { switch (value) { @@ -323,10 +323,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr1>::ToString(SpellAttr1 value) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr1>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<SpellAttr1>::Count() { return 32; } template <> -AC_API_EXPORT SpellAttr1 EnumUtils<SpellAttr1>::FromIndex(size_t index) +AC_API_EXPORT SpellAttr1 EnumUtils<SpellAttr1>::FromIndex(std::size_t index) { switch (index) { @@ -367,7 +367,7 @@ AC_API_EXPORT SpellAttr1 EnumUtils<SpellAttr1>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr1>::ToIndex(SpellAttr1 value) +AC_API_EXPORT std::size_t EnumUtils<SpellAttr1>::ToIndex(SpellAttr1 value) { switch (value) { @@ -452,10 +452,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr2>::ToString(SpellAttr2 value) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr2>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<SpellAttr2>::Count() { return 32; } template <> -AC_API_EXPORT SpellAttr2 EnumUtils<SpellAttr2>::FromIndex(size_t index) +AC_API_EXPORT SpellAttr2 EnumUtils<SpellAttr2>::FromIndex(std::size_t index) { switch (index) { @@ -496,7 +496,7 @@ AC_API_EXPORT SpellAttr2 EnumUtils<SpellAttr2>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr2>::ToIndex(SpellAttr2 value) +AC_API_EXPORT std::size_t EnumUtils<SpellAttr2>::ToIndex(SpellAttr2 value) { switch (value) { @@ -581,10 +581,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr3>::ToString(SpellAttr3 value) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr3>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<SpellAttr3>::Count() { return 32; } template <> -AC_API_EXPORT SpellAttr3 EnumUtils<SpellAttr3>::FromIndex(size_t index) +AC_API_EXPORT SpellAttr3 EnumUtils<SpellAttr3>::FromIndex(std::size_t index) { switch (index) { @@ -625,7 +625,7 @@ AC_API_EXPORT SpellAttr3 EnumUtils<SpellAttr3>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr3>::ToIndex(SpellAttr3 value) +AC_API_EXPORT std::size_t EnumUtils<SpellAttr3>::ToIndex(SpellAttr3 value) { switch (value) { @@ -710,10 +710,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr4>::ToString(SpellAttr4 value) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr4>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<SpellAttr4>::Count() { return 32; } template <> -AC_API_EXPORT SpellAttr4 EnumUtils<SpellAttr4>::FromIndex(size_t index) +AC_API_EXPORT SpellAttr4 EnumUtils<SpellAttr4>::FromIndex(std::size_t index) { switch (index) { @@ -754,7 +754,7 @@ AC_API_EXPORT SpellAttr4 EnumUtils<SpellAttr4>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr4>::ToIndex(SpellAttr4 value) +AC_API_EXPORT std::size_t EnumUtils<SpellAttr4>::ToIndex(SpellAttr4 value) { switch (value) { @@ -839,10 +839,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr5>::ToString(SpellAttr5 value) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr5>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<SpellAttr5>::Count() { return 32; } template <> -AC_API_EXPORT SpellAttr5 EnumUtils<SpellAttr5>::FromIndex(size_t index) +AC_API_EXPORT SpellAttr5 EnumUtils<SpellAttr5>::FromIndex(std::size_t index) { switch (index) { @@ -883,7 +883,7 @@ AC_API_EXPORT SpellAttr5 EnumUtils<SpellAttr5>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr5>::ToIndex(SpellAttr5 value) +AC_API_EXPORT std::size_t EnumUtils<SpellAttr5>::ToIndex(SpellAttr5 value) { switch (value) { @@ -968,10 +968,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr6>::ToString(SpellAttr6 value) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr6>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<SpellAttr6>::Count() { return 32; } template <> -AC_API_EXPORT SpellAttr6 EnumUtils<SpellAttr6>::FromIndex(size_t index) +AC_API_EXPORT SpellAttr6 EnumUtils<SpellAttr6>::FromIndex(std::size_t index) { switch (index) { @@ -1012,7 +1012,7 @@ AC_API_EXPORT SpellAttr6 EnumUtils<SpellAttr6>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr6>::ToIndex(SpellAttr6 value) +AC_API_EXPORT std::size_t EnumUtils<SpellAttr6>::ToIndex(SpellAttr6 value) { switch (value) { @@ -1097,10 +1097,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellAttr7>::ToString(SpellAttr7 value) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr7>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<SpellAttr7>::Count() { return 32; } template <> -AC_API_EXPORT SpellAttr7 EnumUtils<SpellAttr7>::FromIndex(size_t index) +AC_API_EXPORT SpellAttr7 EnumUtils<SpellAttr7>::FromIndex(std::size_t index) { switch (index) { @@ -1141,7 +1141,7 @@ AC_API_EXPORT SpellAttr7 EnumUtils<SpellAttr7>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<SpellAttr7>::ToIndex(SpellAttr7 value) +AC_API_EXPORT std::size_t EnumUtils<SpellAttr7>::ToIndex(SpellAttr7 value) { switch (value) { @@ -1383,10 +1383,10 @@ AC_API_EXPORT EnumText EnumUtils<SpellCastResult>::ToString(SpellCastResult valu } template <> -AC_API_EXPORT size_t EnumUtils<SpellCastResult>::Count() { return 189; } +AC_API_EXPORT std::size_t EnumUtils<SpellCastResult>::Count() { return 189; } template <> -AC_API_EXPORT SpellCastResult EnumUtils<SpellCastResult>::FromIndex(size_t index) +AC_API_EXPORT SpellCastResult EnumUtils<SpellCastResult>::FromIndex(std::size_t index) { switch (index) { @@ -1584,7 +1584,7 @@ AC_API_EXPORT SpellCastResult EnumUtils<SpellCastResult>::FromIndex(size_t index } template <> -AC_API_EXPORT size_t EnumUtils<SpellCastResult>::ToIndex(SpellCastResult value) +AC_API_EXPORT std::size_t EnumUtils<SpellCastResult>::ToIndex(SpellCastResult value) { switch (value) { @@ -1812,10 +1812,10 @@ AC_API_EXPORT EnumText EnumUtils<AuraStateType>::ToString(AuraStateType value) } template <> -AC_API_EXPORT size_t EnumUtils<AuraStateType>::Count() { return 18; } +AC_API_EXPORT std::size_t EnumUtils<AuraStateType>::Count() { return 18; } template <> -AC_API_EXPORT AuraStateType EnumUtils<AuraStateType>::FromIndex(size_t index) +AC_API_EXPORT AuraStateType EnumUtils<AuraStateType>::FromIndex(std::size_t index) { switch (index) { @@ -1842,7 +1842,7 @@ AC_API_EXPORT AuraStateType EnumUtils<AuraStateType>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<AuraStateType>::ToIndex(AuraStateType value) +AC_API_EXPORT std::size_t EnumUtils<AuraStateType>::ToIndex(AuraStateType value) { switch (value) { @@ -1913,10 +1913,10 @@ AC_API_EXPORT EnumText EnumUtils<Mechanics>::ToString(Mechanics value) } template <> -AC_API_EXPORT size_t EnumUtils<Mechanics>::Count() { return 32; } +AC_API_EXPORT std::size_t EnumUtils<Mechanics>::Count() { return 32; } template <> -AC_API_EXPORT Mechanics EnumUtils<Mechanics>::FromIndex(size_t index) +AC_API_EXPORT Mechanics EnumUtils<Mechanics>::FromIndex(std::size_t index) { switch (index) { @@ -1957,7 +1957,7 @@ AC_API_EXPORT Mechanics EnumUtils<Mechanics>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<Mechanics>::ToIndex(Mechanics value) +AC_API_EXPORT std::size_t EnumUtils<Mechanics>::ToIndex(Mechanics value) { switch (value) { @@ -2184,10 +2184,10 @@ AC_API_EXPORT EnumText EnumUtils<Emote>::ToString(Emote value) } template <> -AC_API_EXPORT size_t EnumUtils<Emote>::Count() { return 174; } +AC_API_EXPORT std::size_t EnumUtils<Emote>::Count() { return 174; } template <> -AC_API_EXPORT Emote EnumUtils<Emote>::FromIndex(size_t index) +AC_API_EXPORT Emote EnumUtils<Emote>::FromIndex(std::size_t index) { switch (index) { @@ -2370,7 +2370,7 @@ AC_API_EXPORT Emote EnumUtils<Emote>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<Emote>::ToIndex(Emote value) +AC_API_EXPORT std::size_t EnumUtils<Emote>::ToIndex(Emote value) { switch (value) { @@ -2618,10 +2618,10 @@ AC_API_EXPORT EnumText EnumUtils<ChatMsg>::ToString(ChatMsg value) } template <> -AC_API_EXPORT size_t EnumUtils<ChatMsg>::Count() { return 53; } +AC_API_EXPORT std::size_t EnumUtils<ChatMsg>::Count() { return 53; } template <> -AC_API_EXPORT ChatMsg EnumUtils<ChatMsg>::FromIndex(size_t index) +AC_API_EXPORT ChatMsg EnumUtils<ChatMsg>::FromIndex(std::size_t index) { switch (index) { @@ -2683,7 +2683,7 @@ AC_API_EXPORT ChatMsg EnumUtils<ChatMsg>::FromIndex(size_t index) } template <> -AC_API_EXPORT size_t EnumUtils<ChatMsg>::ToIndex(ChatMsg value) +AC_API_EXPORT std::size_t EnumUtils<ChatMsg>::ToIndex(ChatMsg value) { switch (value) { diff --git a/src/test/common/Configuration/Config.cpp b/src/test/common/Configuration/Config.cpp index c3c1e67d31..df1889a88a 100644 --- a/src/test/common/Configuration/Config.cpp +++ b/src/test/common/Configuration/Config.cpp @@ -16,6 +16,7 @@ */ #include "Config.h" +#include "Define.h" #include "gtest/gtest.h" #include <boost/filesystem.hpp> diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 34f4a2f57c..1d2d47a37c 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -245,9 +245,9 @@ uint32 ReadBuild(int locale) std::string text = std::string(m.getPointer(), m.getSize()); m.close(); - size_t pos = text.find("version=\""); - size_t pos1 = pos + strlen("version=\""); - size_t pos2 = text.find("\"", pos1); + std::size_t pos = text.find("version=\""); + std::size_t pos1 = pos + strlen("version=\""); + std::size_t pos2 = text.find("\"", pos1); if (pos == text.npos || pos2 == text.npos || pos1 >= pos2) { printf("Fatal error: Invalid %s file format!\n", filename.c_str()); @@ -277,7 +277,7 @@ uint32 ReadMapDBC() exit(1); } - size_t map_count = dbc.getRecordCount(); + std::size_t map_count = dbc.getRecordCount(); map_ids.resize(map_count); for (uint32 x = 0; x < map_count; ++x) { @@ -1094,12 +1094,12 @@ void ExtractCameraFiles(int locale, bool basicLocale) // get camera file list from DBC std::vector<std::string> camerafiles; - size_t cam_count = camdbc.getRecordCount(); + std::size_t cam_count = camdbc.getRecordCount(); - for (size_t i = 0; i < cam_count; ++i) + for (std::size_t i = 0; i < cam_count; ++i) { std::string camFile(camdbc.getRecord(i).getString(1)); - size_t loc = camFile.find(".mdx"); + std::size_t loc = camFile.find(".mdx"); if (loc != std::string::npos) { camFile.replace(loc, 4, ".m2"); diff --git a/src/tools/map_extractor/dbcfile.cpp b/src/tools/map_extractor/dbcfile.cpp index b4324014a6..b349dfc756 100644 --- a/src/tools/map_extractor/dbcfile.cpp +++ b/src/tools/map_extractor/dbcfile.cpp @@ -58,7 +58,7 @@ bool DBCFile::open() data = new unsigned char[recordSize * recordCount + stringSize]; stringTable = data + recordSize * recordCount; - size_t data_size = recordSize * recordCount + stringSize; + std::size_t data_size = recordSize * recordCount + stringSize; if (f.read(data, data_size) != data_size) return false; f.close(); @@ -69,18 +69,18 @@ DBCFile::~DBCFile() delete [] data; } -DBCFile::Record DBCFile::getRecord(size_t id) +DBCFile::Record DBCFile::getRecord(std::size_t id) { assert(data); return Record(*this, data + id * recordSize); } -size_t DBCFile::getMaxId() +std::size_t DBCFile::getMaxId() { assert(data); - size_t maxId = 0; - for (size_t i = 0; i < getRecordCount(); ++i) + std::size_t maxId = 0; + for (std::size_t i = 0; i < getRecordCount(); ++i) { if (maxId < getRecord(i).getUInt(0)) maxId = getRecord(i).getUInt(0); diff --git a/src/tools/map_extractor/dbcfile.h b/src/tools/map_extractor/dbcfile.h index 6b8ed5086b..b8158811b3 100644 --- a/src/tools/map_extractor/dbcfile.h +++ b/src/tools/map_extractor/dbcfile.h @@ -53,25 +53,25 @@ public: class Record // cppcheck-suppress ctuOneDefinitionRuleViolation { public: - [[nodiscard]] float getFloat(size_t field) const + [[nodiscard]] float getFloat(std::size_t field) const { assert(field < file.fieldCount); return *reinterpret_cast<float*>(offset + field * 4); } - [[nodiscard]] unsigned int getUInt(size_t field) const + [[nodiscard]] unsigned int getUInt(std::size_t field) const { assert(field < file.fieldCount); return *reinterpret_cast<unsigned int*>(offset + field * 4); } - [[nodiscard]] int getInt(size_t field) const + [[nodiscard]] int getInt(std::size_t field) const { assert(field < file.fieldCount); return *reinterpret_cast<int*>(offset + field * 4); } - [[nodiscard]] const char* getString(size_t field) const + [[nodiscard]] const char* getString(std::size_t field) const { assert(field < file.fieldCount); - size_t stringOffset = getUInt(field); + std::size_t stringOffset = getUInt(field); assert(stringOffset < file.stringSize); return reinterpret_cast<char*>(file.stringTable + stringOffset); } @@ -116,21 +116,21 @@ public: }; // Get record by id - Record getRecord(size_t id); + Record getRecord(std::size_t id); /// Get begin iterator over records Iterator begin(); /// Get begin iterator over records Iterator end(); /// Trivial - [[nodiscard]] size_t getRecordCount() const { return recordCount;} - [[nodiscard]] size_t getFieldCount() const { return fieldCount; } - size_t getMaxId(); + [[nodiscard]] std::size_t getRecordCount() const { return recordCount;} + [[nodiscard]] std::size_t getFieldCount() const { return fieldCount; } + std::size_t getMaxId(); private: std::string filename; - size_t recordSize; - size_t recordCount; - size_t fieldCount; - size_t stringSize; + std::size_t recordSize; + std::size_t recordCount; + std::size_t fieldCount; + std::size_t stringSize; unsigned char* data; unsigned char* stringTable; }; diff --git a/src/tools/map_extractor/mpq_libmpq.cpp b/src/tools/map_extractor/mpq_libmpq.cpp index cac360087d..5b70a933ad 100644 --- a/src/tools/map_extractor/mpq_libmpq.cpp +++ b/src/tools/map_extractor/mpq_libmpq.cpp @@ -93,12 +93,12 @@ MPQFile::MPQFile(const char* filename): buffer = nullptr; } -size_t MPQFile::read(void* dest, size_t bytes) +std::size_t MPQFile::read(void* dest, std::size_t bytes) { if (eof) return 0; - size_t rpos = pointer + bytes; - if (rpos > size_t(size)) + std::size_t rpos = pointer + bytes; + if (rpos > std::size_t(size)) { bytes = size - pointer; eof = true; diff --git a/src/tools/map_extractor/mpq_libmpq04.h b/src/tools/map_extractor/mpq_libmpq04.h index 049cd79872..c7483e25bc 100644 --- a/src/tools/map_extractor/mpq_libmpq04.h +++ b/src/tools/map_extractor/mpq_libmpq04.h @@ -85,9 +85,9 @@ class MPQFile public: MPQFile(const char* filename); // filenames are not case sensitive ~MPQFile() { close(); } - size_t read(void* dest, size_t bytes); - size_t getSize() { return size; } - size_t getPos() { return pointer; } + std::size_t read(void* dest, std::size_t bytes); + std::size_t getSize() { return size; } + std::size_t getPos() { return pointer; } char* getBuffer() { return buffer; } char* getPointer() { return buffer + pointer; } bool isEof() { return eof; } diff --git a/src/tools/vmap4_extractor/adtfile.cpp b/src/tools/vmap4_extractor/adtfile.cpp index 8367ba3d0e..5af0937ed1 100644 --- a/src/tools/vmap4_extractor/adtfile.cpp +++ b/src/tools/vmap4_extractor/adtfile.cpp @@ -42,12 +42,12 @@ char* GetPlainName(char* FileName) return FileName; } -void fixnamen(char* name, size_t len) +void fixnamen(char* name, std::size_t len) { if (len < 3) return; - for (size_t i = 0; i < len - 3; i++) + for (std::size_t i = 0; i < len - 3; i++) { if (i > 0 && name[i] >= 'A' && name[i] <= 'Z' && isalpha(name[i - 1])) name[i] |= 0x20; @@ -56,16 +56,16 @@ void fixnamen(char* name, size_t len) } //extension in lowercase - for (size_t i = len - 3; i < len; i++) + for (std::size_t i = len - 3; i < len; i++) name[i] |= 0x20; } -void fixname2(char* name, size_t len) +void fixname2(char* name, std::size_t len) { if (len < 3) return; - for (size_t i = 0; i < len - 3; i++) + for (std::size_t i = 0; i < len - 3; i++) if (name[i] == ' ') name[i] = '_'; } @@ -105,7 +105,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY) flipcc(fourcc); fourcc[4] = 0; - size_t nextpos = _file.getPos() + size; + std::size_t nextpos = _file.getPos() + size; if (!strcmp(fourcc, "MCIN")) { diff --git a/src/tools/vmap4_extractor/adtfile.h b/src/tools/vmap4_extractor/adtfile.h index f91a215dd8..201806f3a3 100644 --- a/src/tools/vmap4_extractor/adtfile.h +++ b/src/tools/vmap4_extractor/adtfile.h @@ -75,8 +75,8 @@ public: const char* GetPlainName(const char* FileName); char* GetPlainName(char* FileName); char* GetExtension(char* FileName); -void fixnamen(char* name, size_t len); -void fixname2(char* name, size_t len); -//void fixMapNamen(char *name, size_t len); +void fixnamen(char* name, std::size_t len); +void fixname2(char* name, std::size_t len); +//void fixMapNamen(char *name, std::size_t len); #endif diff --git a/src/tools/vmap4_extractor/dbcfile.cpp b/src/tools/vmap4_extractor/dbcfile.cpp index 6b003bb60a..21cda295a9 100644 --- a/src/tools/vmap4_extractor/dbcfile.cpp +++ b/src/tools/vmap4_extractor/dbcfile.cpp @@ -76,7 +76,7 @@ DBCFile::~DBCFile() delete [] data; } -DBCFile::Record DBCFile::getRecord(size_t id) +DBCFile::Record DBCFile::getRecord(std::std::size_t id) { assert(data); return Record(*this, data + id * recordSize); diff --git a/src/tools/vmap4_extractor/dbcfile.h b/src/tools/vmap4_extractor/dbcfile.h index 593a85b963..adde0b2ae1 100644 --- a/src/tools/vmap4_extractor/dbcfile.h +++ b/src/tools/vmap4_extractor/dbcfile.h @@ -64,30 +64,30 @@ public: offset = r.offset; return *this; } - [[nodiscard]] float getFloat(size_t field) const + [[nodiscard]] float getFloat(std::size_t field) const { assert(field < file.fieldCount); return *reinterpret_cast<float*>(offset + field * 4); } - [[nodiscard]] unsigned int getUInt(size_t field) const + [[nodiscard]] unsigned int getUInt(std::size_t field) const { assert(field < file.fieldCount); return *reinterpret_cast<unsigned int*>(offset + (field * 4)); } - [[nodiscard]] int getInt(size_t field) const + [[nodiscard]] int getInt(std::size_t field) const { assert(field < file.fieldCount); return *reinterpret_cast<int*>(offset + field * 4); } - [[nodiscard]] unsigned char getByte(size_t ofs) const + [[nodiscard]] unsigned char getByte(std::size_t ofs) const { assert(ofs < file.recordSize); return *reinterpret_cast<unsigned char*>(offset + ofs); } - [[nodiscard]] const char* getString(size_t field) const + [[nodiscard]] const char* getString(std::size_t field) const { assert(field < file.fieldCount); - size_t stringOffset = getUInt(field); + std::size_t stringOffset = getUInt(field); assert(stringOffset < file.stringSize); //char * tmp = (char*)file.stringTable + stringOffset; //unsigned char * tmp2 = file.stringTable + stringOffset; @@ -134,21 +134,21 @@ public: }; // Get record by id - Record getRecord(size_t id); + Record getRecord(std::size_t id); /// Get begin iterator over records Iterator begin(); /// Get begin iterator over records Iterator end(); /// Trivial - [[nodiscard]] size_t getRecordCount() const { return recordCount;} - [[nodiscard]] size_t getFieldCount() const { return fieldCount; } + [[nodiscard]] std::size_t getRecordCount() const { return recordCount;} + [[nodiscard]] std::size_t getFieldCount() const { return fieldCount; } private: std::string filename; - size_t recordSize; - size_t recordCount; - size_t fieldCount; - size_t stringSize; + std::size_t recordSize; + std::size_t recordCount; + std::size_t fieldCount; + std::size_t stringSize; unsigned char* data; unsigned char* stringTable; }; diff --git a/src/tools/vmap4_extractor/mpq_libmpq.cpp b/src/tools/vmap4_extractor/mpq_libmpq.cpp index d8232388f3..2e5e4eb2b7 100644 --- a/src/tools/vmap4_extractor/mpq_libmpq.cpp +++ b/src/tools/vmap4_extractor/mpq_libmpq.cpp @@ -99,12 +99,12 @@ MPQFile::MPQFile(const char* filename): buffer = nullptr; } -size_t MPQFile::read(void* dest, size_t bytes) +std::size_t MPQFile::read(void* dest, std::size_t bytes) { if (eof) return 0; - size_t rpos = pointer + bytes; - if (rpos > size_t(size)) + std::size_t rpos = pointer + bytes; + if (rpos > std::size_t(size)) { bytes = size - pointer; eof = true; diff --git a/src/tools/vmap4_extractor/mpq_libmpq04.h b/src/tools/vmap4_extractor/mpq_libmpq04.h index 0530a31f3d..1cceb1faf1 100644 --- a/src/tools/vmap4_extractor/mpq_libmpq04.h +++ b/src/tools/vmap4_extractor/mpq_libmpq04.h @@ -86,9 +86,9 @@ class MPQFile public: MPQFile(const char* filename); // filenames are not case sensitive ~MPQFile() { close(); } - size_t read(void* dest, size_t bytes); - size_t getSize() { return size; } - size_t getPos() { return pointer; } + std::size_t read(void* dest, std::size_t bytes); + std::size_t getSize() { return size; } + std::size_t getPos() { return pointer; } char* getBuffer() { return buffer; } char* getPointer() { return buffer + pointer; } bool isEof() { return eof; } diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index 2d3e227518..3acd698727 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -485,7 +485,7 @@ int main(int argc, char** argv) map_ids[x].id = dbc->getRecord(x).getUInt(0); char const* map_name = dbc->getRecord(x).getString(1); - size_t max_map_name_length = sizeof(map_ids[x].name); + std::size_t max_map_name_length = sizeof(map_ids[x].name); if (strlen(map_name) >= max_map_name_length) { delete dbc; diff --git a/src/tools/vmap4_extractor/wdtfile.cpp b/src/tools/vmap4_extractor/wdtfile.cpp index 0a0ff125b3..1a52342408 100644 --- a/src/tools/vmap4_extractor/wdtfile.cpp +++ b/src/tools/vmap4_extractor/wdtfile.cpp @@ -63,7 +63,7 @@ bool WDTFile::init(uint32 mapId) flipcc(fourcc); fourcc[4] = 0; - size_t nextpos = _file.getPos() + size; + std::size_t nextpos = _file.getPos() + size; if (!strcmp(fourcc, "MAIN")) { diff --git a/src/tools/vmap4_extractor/wmo.cpp b/src/tools/vmap4_extractor/wmo.cpp index 0f303d0a46..963038099e 100644 --- a/src/tools/vmap4_extractor/wmo.cpp +++ b/src/tools/vmap4_extractor/wmo.cpp @@ -56,7 +56,7 @@ bool WMORoot::open() flipcc(fourcc); fourcc[4] = 0; - size_t nextpos = f.getPos() + size; + std::size_t nextpos = f.getPos() + size; if (!strcmp(fourcc, "MOHD")) // header { @@ -185,7 +185,7 @@ bool WMOGroup::open(WMORoot* rootWMO) size = 68; } fourcc[4] = 0; - size_t nextpos = f.getPos() + size; + std::size_t nextpos = f.getPos() + size; LiquEx_size = 0; liquflags = 0; |