refactor(src/common): remove unused imports (#19506)

* refactor(src/common): remove unused imports

* fix: build

* chore: fix build

* chore: size_t -> std::size_t

* chore: fix fuckup from previous commit

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build with std::size_t

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build

* chore: fix build
This commit is contained in:
Francesco Borzì
2024-07-31 01:06:46 +02:00
committed by GitHub
parent 06a608d244
commit 02a05fbd4c
200 changed files with 522 additions and 581 deletions

View File

@@ -18,8 +18,6 @@
#ifndef AsioHacksFwd_h__
#define AsioHacksFwd_h__
#include <boost/version.hpp>
/**
Collection of forward declarations to improve compile time
*/

View File

@@ -18,7 +18,6 @@
#ifndef Resolver_h__
#define Resolver_h__
#include "IoContext.h"
#include "Optional.h"
#include <boost/asio/ip/tcp.hpp>
#include <string>

View File

@@ -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>

View File

@@ -18,9 +18,6 @@
#ifndef _IMMAPMANAGER_H
#define _IMMAPMANAGER_H
#include "Define.h"
#include <string>
// Interface for IMMapManger
namespace MMAP
{

View File

@@ -17,8 +17,6 @@
#include "MMapFactory.h"
#include <cstring>
#include <set>
namespace MMAP
{
// ######################## MMapFactory ########################

View File

@@ -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
{

View File

@@ -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);

View File

@@ -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];
}

View File

@@ -18,8 +18,6 @@
#ifndef _VMAPFACTORY_H
#define _VMAPFACTORY_H
#include "IVMapMgr.h"
// This is the access point to the VMapMgr.
namespace VMAP
{

View File

@@ -18,7 +18,6 @@
#ifndef _VMAPMANAGER2_H
#define _VMAPMANAGER2_H
#include "Common.h"
#include "IVMapMgr.h"
#include <mutex>
#include <unordered_map>

View File

@@ -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>

View File

@@ -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>

View File

@@ -17,7 +17,6 @@
#ifndef _VMAPDEFINITIONS_H
#define _VMAPDEFINITIONS_H
#include <cstring>
#define LIQUID_TILE_SIZE (533.333f / 128.f)

View File

@@ -18,7 +18,6 @@
#ifndef _VMAPTOOLS_H
#define _VMAPTOOLS_H
#include "Define.h"
#include <G3D/AABox.h>
#include <G3D/CollisionDetection.h>

View File

@@ -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>

View File

@@ -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 == '-')

View File

@@ -18,7 +18,6 @@
#ifndef CONFIG_H
#define CONFIG_H
#include "Define.h"
#include <stdexcept>
#include <string_view>
#include <vector>

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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)); }

View File

@@ -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);

View File

@@ -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; }

View File

@@ -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

View File

@@ -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];

View File

@@ -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;

View File

@@ -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();

View File

@@ -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>

View File

@@ -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;
};
}

View File

@@ -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();

View File

@@ -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);

View File

@@ -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?");

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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"));
}

View File

@@ -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);

View File

@@ -21,7 +21,6 @@
#include "CompilerDefs.h"
#include <cinttypes>
#include <climits>
#include <cstddef>
#define ACORE_LITTLEENDIAN 0
#define ACORE_BIGENDIAN 1

View File

@@ -20,7 +20,6 @@
#include "Define.h"
#include "ObjectRegistry.h"
#include "TypeList.h"
/** FactoryHolder holds a factory object of a specific type
*/

View File

@@ -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
*/

View File

@@ -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>

View File

@@ -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);
}

View File

@@ -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);
// }

View File

@@ -24,7 +24,6 @@
* to overload its types as a visit method is called.
*/
#include "Define.h"
#include "Dynamic/TypeContainer.h"
// forward declaration

View File

@@ -22,7 +22,6 @@
#include "LogCommon.h"
#include <stdexcept>
#include <string>
#include <vector>
struct LogMessage;

View File

@@ -19,6 +19,7 @@
#define APPENDERCONSOLE_H
#include "Appender.h"
#include <vector>
// EnumUtils: DESCRIBE THIS
enum ColorTypes

View File

@@ -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());

View File

@@ -20,6 +20,7 @@
#include "Appender.h"
#include <atomic>
#include <vector>
class AppenderFile : public Appender
{

View File

@@ -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);

View File

@@ -21,7 +21,6 @@
#include "Define.h"
#include "LogCommon.h"
#include "StringFormat.h"
#include <memory>
#include <unordered_map>
#include <vector>

View File

@@ -18,7 +18,6 @@
#ifndef LOGOPERATION_H
#define LOGOPERATION_H
#include "Define.h"
#include <memory>
class Logger;

View File

@@ -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)
{

View File

@@ -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)
{

View File

@@ -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

View File

@@ -19,8 +19,6 @@
#define MPSCQueue_h__
#include <atomic>
#include <memory>
#include <utility>
namespace Acore::Impl
{

View File

@@ -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();
}

View File

@@ -23,8 +23,6 @@
*
*/
#include "Define.h"
namespace Acore
{
template<typename MUTEX>

View File

@@ -18,7 +18,6 @@
#ifndef AsyncCallbackProcessor_h__
#define AsyncCallbackProcessor_h__
#include "Define.h"
#include <algorithm>
#include <vector>

View File

@@ -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));

View File

@@ -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

View File

@@ -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;

View File

@@ -22,7 +22,6 @@
#include "Duration.h"
#include "Random.h"
#include <map>
#include <type_traits>
class EventProcessor;

View File

@@ -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)

View File

@@ -18,7 +18,6 @@
#ifndef IteratorPair_h__
#define IteratorPair_h__
#include "Define.h"
#include <utility>
namespace Acore

View File

@@ -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)
{

View File

@@ -25,9 +25,6 @@
#define _ACORE_PHYSICS_H
#include "Geometry.h"
#include <cmath>
#include <cstdlib>
#include <iostream>
using namespace std;

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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); }

View File

@@ -20,7 +20,6 @@
#include "Define.h"
#include <future>
#include <memory>
#include <string>
#include <vector>

View File

@@ -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())
{

View File

@@ -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);
}

View File

@@ -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.

View File

@@ -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))
{

View File

@@ -18,7 +18,6 @@
#ifndef _ACORE_TOKENIZE_H_
#define _ACORE_TOKENIZE_H_
#include "Common.h"
#include <string_view>
#include <vector>

View File

@@ -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))...);

View File

@@ -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));

View File

@@ -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();
}

View File

@@ -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

View File

@@ -113,7 +113,7 @@ private:
struct AuthHandler
{
AuthStatus status;
size_t packetSize;
std::size_t packetSize;
bool (AuthSession::* handler)();
};

View File

@@ -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())

View File

@@ -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();

View File

@@ -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>
{

View File

@@ -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();
}

View File

@@ -227,7 +227,7 @@ public:
#endif
}
[[nodiscard]] size_t QueueSize() const;
[[nodiscard]] std::size_t QueueSize() const;
private:
uint32 OpenConnections(InternalIndex type, uint8 numConnections);

View File

@@ -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);

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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())
{

View File

@@ -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));

View File

@@ -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);
}

View File

@@ -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) { }

View File

@@ -19,6 +19,7 @@
#define APPENDERDB_H
#include "Appender.h"
#include <vector>
class AppenderDB : public Appender
{

Some files were not shown because too many files have changed in this diff Show More