Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-08-01 15:41:23 +08:00
251 changed files with 4841 additions and 6135 deletions

View File

@@ -3,7 +3,7 @@ ARG TZ=Etc/UTC
# This target lays out the general directory skeleton for AzerothCore, # This target lays out the general directory skeleton for AzerothCore,
# This target isn't intended to be directly used # This target isn't intended to be directly used
FROM ubuntu:$UBUNTU_VERSION as skeleton FROM ubuntu:$UBUNTU_VERSION AS skeleton
ARG DOCKER=1 ARG DOCKER=1
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
@@ -39,7 +39,7 @@ WORKDIR /azerothcore
# This target builds the docker image # This target builds the docker image
# This target can be useful to inspect the explicit outputs from the build, # This target can be useful to inspect the explicit outputs from the build,
FROM skeleton as build FROM skeleton AS build
ARG CTOOLS_BUILD="all" ARG CTOOLS_BUILD="all"
ARG CTYPE="RelWithDebInfo" ARG CTYPE="RelWithDebInfo"
@@ -106,7 +106,7 @@ RUN --mount=type=cache,target=/ccache,sharing=locked \
# Base runtime for services # # Base runtime for services #
############################# #############################
FROM skeleton as runtime FROM skeleton AS runtime
ARG USER_ID=1000 ARG USER_ID=1000
ARG GROUP_ID=1000 ARG GROUP_ID=1000
@@ -144,7 +144,7 @@ ENTRYPOINT ["/usr/bin/env", "bash", "/azerothcore/entrypoint.sh"]
# Auth Server # # Auth Server #
############### ###############
FROM runtime as authserver FROM runtime AS authserver
LABEL description "AzerothCore Auth Server" LABEL description "AzerothCore Auth Server"
ENV ACORE_COMPONENT=authserver ENV ACORE_COMPONENT=authserver
@@ -165,7 +165,7 @@ CMD ["authserver"]
# World Server # # World Server #
################ ################
FROM runtime as worldserver FROM runtime AS worldserver
LABEL description "AzerothCore World Server" LABEL description "AzerothCore World Server"
@@ -188,7 +188,7 @@ CMD ["worldserver"]
# DB Import # # DB Import #
############# #############
FROM runtime as db-import FROM runtime AS db-import
LABEL description "AzerothCore Database Import tool" LABEL description "AzerothCore Database Import tool"
@@ -209,7 +209,7 @@ CMD /azerothcore/env/dist/bin/dbimport
# Client Data # # Client Data #
############### ###############
FROM skeleton as client-data FROM skeleton AS client-data
LABEL description="AzerothCore client-data" LABEL description="AzerothCore client-data"
@@ -231,7 +231,7 @@ CMD bash -c "source /azerothcore/apps/installer/includes/functions.sh && inst_do
# Map Extractors # # Map Extractors #
################## ##################
FROM runtime as tools FROM runtime AS tools
LABEL description "AzerothCore Tools" LABEL description "AzerothCore Tools"

View File

@@ -0,0 +1,9 @@
-- DB update 22024_07_26_00 -> 2024_07_26_01
DELETE FROM `command` WHERE `name`='account set email';
INSERT INTO `command` (`name`, `security`, `help`) VALUES
('account set email', 4, 'Syntax: .account set email $account $email $email_confirmation\nAdd or change an email to the account.');
DELETE FROM `acore_string` WHERE `entry` IN (875);
INSERT INTO `acore_string` (`entry`, `content_default`,`locale_zhCN`) VALUES
(875, 'Your email can\'t be longer than 255 characters, email not changed!', '255');

View File

@@ -0,0 +1,44 @@
-- DB update 2024_07_28_00 -> 2024_07_29_00
--
UPDATE `spell_script_names` SET `ScriptName`='spell_blood_queen_pact_of_the_darkfallen_dmg_aura' WHERE `spell_id`=71340 AND `ScriptName`='spell_blood_queen_pact_of_the_darkfallen_dmg';
UPDATE `spell_script_names` SET `ScriptName`='spell_blood_queen_frenzied_bloodthirst_aura' WHERE `spell_id` IN (70877,71474) AND `ScriptName`='spell_blood_queen_frenzied_bloodthirst';
UPDATE `spell_script_names` SET `ScriptName`='spell_blood_queen_essence_of_the_blood_queen_aura' WHERE `spell_id`=70871 AND `ScriptName`='spell_blood_queen_essence_of_the_blood_queen';
UPDATE `spell_script_names` SET `ScriptName`='spell_icc_stoneform_aura' WHERE `spell_id`=70733 AND `ScriptName`='spell_icc_stoneform';
UPDATE `spell_script_names` SET `ScriptName`='spell_icc_web_wrap_aura' WHERE `spell_id`=70980 AND `ScriptName`='spell_icc_web_wrap';
UPDATE `spell_script_names` SET `ScriptName`='spell_icc_dark_reckoning_aura' WHERE `spell_id`=69483 AND `ScriptName`='spell_icc_dark_reckoning';
UPDATE `spell_script_names` SET `ScriptName`='spell_icc_yf_frozen_orb_aura' WHERE `spell_id`=71274 AND `ScriptName`='spell_icc_yf_frozen_orb';
UPDATE `spell_script_names` SET `ScriptName`='spell_icc_yh_volley_aura' WHERE `spell_id`=71252 AND `ScriptName`='spell_icc_yh_volley';
UPDATE `spell_script_names` SET `ScriptName`='spell_festergut_blighted_spores_aura' WHERE `spell_id` IN (69290,71222,73033,73034) AND `ScriptName`='spell_festergut_blighted_spores';
UPDATE `spell_script_names` SET `ScriptName`='spell_dreamwalker_nightmare_cloud_aura' WHERE `spell_id`=71970 AND `ScriptName`='spell_dreamwalker_nightmare_cloud';
UPDATE `spell_script_names` SET `ScriptName`='spell_dreamwalker_mana_void_aura' WHERE `spell_id`=71085 AND `ScriptName`='spell_dreamwalker_mana_void';
UPDATE `spell_script_names` SET `ScriptName`='spell_dreamwalker_decay_periodic_timer_aura' WHERE `spell_id` IN (70912,70913,70915,70916) AND `ScriptName`='spell_dreamwalker_decay_periodic_timer';
UPDATE `spell_script_names` SET `ScriptName`='spell_dreamwalker_summon_suppresser_aura' WHERE `spell_id`=70912 AND `ScriptName`='spell_dreamwalker_summon_suppresser';
UPDATE `spell_script_names` SET `ScriptName`='spell_valithria_suppression_aura' WHERE `spell_id`=70588 AND `ScriptName`='spell_valithria_suppression';
UPDATE `spell_script_names` SET `ScriptName`='spell_deathwhisper_mana_barrier_aura' WHERE `spell_id`=70842 AND `ScriptName`='spell_deathwhisper_mana_barrier';
UPDATE `spell_script_names` SET `ScriptName`='spell_putricide_grow_stacker_aura' WHERE `spell_id`=70345 AND `ScriptName`='spell_putricide_grow_stacker';
UPDATE `spell_script_names` SET `ScriptName`='spell_putricide_gaseous_bloat_aura' WHERE `spell_id` IN (70672,72455,72832,72833) AND `ScriptName`='spell_putricide_gaseous_bloat';
UPDATE `spell_script_names` SET `ScriptName`='spell_putricide_mutated_plague_aura' WHERE `spell_id` IN (72451,72463,72671,72672) AND `ScriptName`='spell_putricide_mutated_plague';
UPDATE `spell_script_names` SET `ScriptName`='spell_putricide_unbound_plague_dmg_aura' WHERE `spell_id` IN (70911,72854,72855,72856) AND `ScriptName`='spell_putricide_unbound_plague_dmg';
UPDATE `spell_script_names` SET `ScriptName`='spell_putricide_mutated_transformation_dismiss_aura' WHERE `spell_id` IN (70405,72508,72509,72510) AND `ScriptName`='spell_putricide_mutated_transformation_dismiss';
UPDATE `spell_script_names` SET `ScriptName`='spell_sindragosa_permeating_chill_aura' WHERE `spell_id`=70107 AND `ScriptName`='spell_sindragosa_permeating_chill';
UPDATE `spell_script_names` SET `ScriptName`='spell_sindragosa_instability_aura' WHERE `spell_id`=69766 AND `ScriptName`='spell_sindragosa_instability';
UPDATE `spell_script_names` SET `ScriptName`='spell_sindragosa_frost_beacon_aura' WHERE `spell_id`=70126 AND `ScriptName`='spell_sindragosa_frost_beacon';
UPDATE `spell_script_names` SET `ScriptName`='spell_sindragosa_soul_preservation_aura' WHERE `spell_id`=72465 AND `ScriptName`='spell_sindragosa_soul_preservation';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_infest_aura' WHERE `spell_id` IN (70541,73779,73780,73781) AND `ScriptName`='spell_the_lich_king_infest';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_necrotic_plague_aura' WHERE `spell_id` IN (70337,73912,73913,73914) AND `ScriptName`='spell_the_lich_king_necrotic_plague';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_shadow_trap_visual_aura' WHERE `spell_id`=73530 AND `ScriptName`='spell_the_lich_king_shadow_trap_visual';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_soul_reaper_aura' WHERE `spell_id` IN (69409,73797,73798,73799) AND `ScriptName`='spell_the_lich_king_soul_reaper';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_vile_spirits_aura' WHERE `spell_id`=70498 AND `ScriptName`='spell_the_lich_king_vile_spirits';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_harvest_soul_aura' WHERE `spell_id` IN (68980,74296,74297,74325) AND `ScriptName`='spell_the_lich_king_harvest_soul';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_lights_favor_aura' WHERE `spell_id`=69382 AND `ScriptName`='spell_the_lich_king_lights_favor';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_dark_hunger_aura' WHERE `spell_id`=69383 AND `ScriptName`='spell_the_lich_king_dark_hunger';
UPDATE `spell_script_names` SET `ScriptName`='spell_the_lich_king_soul_rip_aura' WHERE `spell_id`=69397 AND `ScriptName`='spell_the_lich_king_soul_rip';
UPDATE `spell_script_names` SET `ScriptName`='spell_igb_rocket_pack_aura' WHERE `spell_id`=68721 AND `ScriptName`='spell_igb_rocket_pack';
UPDATE `spell_script_names` SET `ScriptName`='spell_igb_rocket_pack_useable_aura' WHERE `spell_id`=70348 AND `ScriptName`='spell_igb_rocket_pack_useable';
UPDATE `spell_script_names` SET `ScriptName`='spell_igb_explosion_main_aura' WHERE `spell_id` IN (72134,72137) AND `ScriptName`='spell_igb_explosion_main';
UPDATE `spell_script_names` SET `ScriptName`='spell_igb_periodic_trigger_with_power_cost_aura' WHERE `spell_id` IN (69470,69487) AND `ScriptName`='spell_igb_periodic_trigger_with_power_cost';
UPDATE `spell_script_names` SET `ScriptName`='spell_igb_overheat_aura' WHERE `spell_id`=69487 AND `ScriptName`='spell_igb_overheat';
UPDATE `spell_script_names` SET `ScriptName`='spell_igb_on_gunship_deck_aura' WHERE `spell_id` IN (70120,70121) AND `ScriptName`='spell_igb_on_gunship_deck';
UPDATE `spell_script_names` SET `ScriptName`='spell_blood_council_shadow_prison_aura' WHERE `spell_id`=73001 AND `ScriptName`='spell_blood_council_shadow_prison';
UPDATE `spell_script_names` SET `ScriptName`='spell_valanar_kinetic_bomb_absorb_aura' WHERE `spell_id`=72054 AND `ScriptName`='spell_valanar_kinetic_bomb_absorb';
UPDATE `spell_script_names` SET `ScriptName`='spell_rotface_unstable_ooze_explosion_suicide_aura' WHERE `spell_id`=71441 AND `ScriptName`='spell_rotface_unstable_ooze_explosion_suicide';

View File

@@ -0,0 +1,3 @@
-- DB update 2024_07_29_00 -> 2024_07_29_01
--
UPDATE `creature_template` SET `flags_extra` = `flags_extra`|256 WHERE (`entry` = 22947);

View File

@@ -0,0 +1,4 @@
-- DB update 2024_07_29_01 -> 2024_07_30_00
-- Wing Buffet
DELETE FROM `spell_custom_attr` WHERE `spell_id`=37319;
INSERT INTO `spell_custom_attr` (`spell_id`, `attributes`) VALUES (37319, 4);

View File

@@ -0,0 +1,5 @@
-- DB update 2024_07_30_00 -> 2024_07_30_01
--
DELETE FROM `spell_proc_event` WHERE `entry` = 40484;
INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `procPhase`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES
(40484, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0);

View File

@@ -0,0 +1,3 @@
-- DB update 2024_07_30_01 -> 2024_07_30_02
--
UPDATE `creature_template` SET `mechanic_immune_mask` = `mechanic_immune_mask`&~33554432 WHERE `entry` = 23419;

View File

@@ -0,0 +1,2 @@
-- DB update 2024_07_30_02 -> 2024_07_31_00
UPDATE `game_event` SET `start_time`='2008-07-31 12:00:00', `end_time`='2008-08-05 12:00:00', `occurence` = 60, `description` = 'L70ETC BlizzCon Concert' WHERE `eventEntry` = 32;

View File

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

View File

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

View File

@@ -40,7 +40,7 @@ namespace
template<> struct HashTrait< GameObjectModel> 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> template<> struct PositionTrait< GameObjectModel>

View File

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

View File

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

View File

@@ -18,11 +18,7 @@
#ifndef _MMAP_FACTORY_H #ifndef _MMAP_FACTORY_H
#define _MMAP_FACTORY_H #define _MMAP_FACTORY_H
#include "DetourAlloc.h"
#include "DetourExtended.h"
#include "DetourNavMesh.h"
#include "MMapMgr.h" #include "MMapMgr.h"
#include <unordered_map>
namespace MMAP namespace MMAP
{ {

View File

@@ -175,7 +175,7 @@ namespace MMAP
unsigned char* data = (unsigned char*)dtAlloc(fileHeader.size, DT_ALLOC_PERM); unsigned char* data = (unsigned char*)dtAlloc(fileHeader.size, DT_ALLOC_PERM);
ASSERT(data); ASSERT(data);
size_t result = fread(data, fileHeader.size, 1, file); std::size_t result = fread(data, fileHeader.size, 1, file);
if (!result) if (!result)
{ {
LOG_ERROR("maps", "MMAP:loadMap: Bad header or data in mmap {:03}{:02}{:02}.mmtile", mapId, x, y); 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 "DetourAlloc.h"
#include "DetourExtended.h" #include "DetourExtended.h"
#include "DetourNavMesh.h" #include "DetourNavMesh.h"
#include <shared_mutex>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
// memory management // 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]; return (void*)new unsigned char[size];
} }

View File

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

View File

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

View File

@@ -21,7 +21,6 @@
#include "BoundingIntervalHierarchy.h" #include "BoundingIntervalHierarchy.h"
#include "Define.h" #include "Define.h"
#include <G3D/AABox.h> #include <G3D/AABox.h>
#include <G3D/HashTrait.h>
#include <G3D/Ray.h> #include <G3D/Ray.h>
#include <G3D/Vector3.h> #include <G3D/Vector3.h>

View File

@@ -1,7 +1,6 @@
#ifndef _REGULAR_GRID_H #ifndef _REGULAR_GRID_H
#define _REGULAR_GRID_H #define _REGULAR_GRID_H
#include <G3D/BoundsTrait.h>
#include <G3D/PositionTrait.h> #include <G3D/PositionTrait.h>
#include <G3D/Ray.h> #include <G3D/Ray.h>
#include <G3D/Table.h> #include <G3D/Table.h>

View File

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

View File

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

View File

@@ -19,10 +19,7 @@
#define AZEROTHCORE_COMMON_H #define AZEROTHCORE_COMMON_H
#include "Define.h" #include "Define.h"
#include <array>
#include <memory>
#include <string> #include <string>
#include <utility>
#if AC_PLATFORM == AC_PLATFORM_WINDOWS #if AC_PLATFORM == AC_PLATFORM_WINDOWS
#include <ws2tcpip.h> #include <ws2tcpip.h>

View File

@@ -46,9 +46,9 @@ namespace
// Check system configs like *server.conf* // Check system configs like *server.conf*
bool IsAppConfig(std::string_view fileName) bool IsAppConfig(std::string_view fileName)
{ {
size_t foundAuth = fileName.find("authserver.conf"); std::size_t foundAuth = fileName.find("authserver.conf");
size_t foundWorld = fileName.find("worldserver.conf"); std::size_t foundWorld = fileName.find("worldserver.conf");
size_t foundImport = fileName.find("dbimport.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; 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.* // Check logging system configs like Appender.* and Logger.*
bool IsLoggingSystemOptions(std::string_view optionName) bool IsLoggingSystemOptions(std::string_view optionName)
{ {
size_t foundAppender = optionName.find("Appender."); std::size_t foundAppender = optionName.find("Appender.");
size_t foundLogger = optionName.find("Logger."); std::size_t foundLogger = optionName.find("Logger.");
return foundAppender != std::string_view::npos || foundLogger != std::string_view::npos; return foundAppender != std::string_view::npos || foundLogger != std::string_view::npos;
} }
@@ -223,7 +223,7 @@ namespace
std::string result; std::string result;
const char* str = key.c_str(); const char* str = key.c_str();
size_t n = key.length(); std::size_t n = key.length();
char curr; char curr;
bool isEnd; bool isEnd;
@@ -231,7 +231,7 @@ namespace
bool currIsNumeric; bool currIsNumeric;
bool nextIsNumeric; bool nextIsNumeric;
for (size_t i = 0; i < n; ++i) for (std::size_t i = 0; i < n; ++i)
{ {
curr = str[i]; curr = str[i];
if (curr == ' ' || curr == '.' || curr == '-') if (curr == ' ' || curr == '.' || curr == '-')

View File

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

View File

@@ -37,7 +37,7 @@ void Acore::Crypto::AES::Init(Key const& key)
ASSERT(status); 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())); ASSERT(length <= static_cast<size_t>(std::numeric_limits<int>::max()));
int len = static_cast<int>(length); int len = static_cast<int>(length);

View File

@@ -27,9 +27,9 @@ namespace Acore::Crypto
class AC_COMMON_API AES class AC_COMMON_API AES
{ {
public: public:
static constexpr size_t IV_SIZE_BYTES = 12; static constexpr std::size_t IV_SIZE_BYTES = 12;
static constexpr size_t KEY_SIZE_BYTES = 16; static constexpr std::size_t KEY_SIZE_BYTES = 16;
static constexpr size_t TAG_SIZE_BYTES = 12; static constexpr std::size_t TAG_SIZE_BYTES = 12;
using IV = std::array<uint8, IV_SIZE_BYTES>; using IV = std::array<uint8, IV_SIZE_BYTES>;
using Key = std::array<uint8, KEY_SIZE_BYTES>; using Key = std::array<uint8, KEY_SIZE_BYTES>;
@@ -40,7 +40,7 @@ namespace Acore::Crypto
void Init(Key const& key); 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: private:
EVP_CIPHER_CTX* _ctx; EVP_CIPHER_CTX* _ctx;

View File

@@ -40,7 +40,7 @@ Acore::Crypto::ARC4::~ARC4()
#endif #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); int result1 = EVP_CIPHER_CTX_set_key_length(_ctx, len);
ASSERT(result1 == 1); ASSERT(result1 == 1);
@@ -48,7 +48,7 @@ void Acore::Crypto::ARC4::Init(uint8 const* seed, size_t len)
ASSERT(result2 == 1); 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 outlen = 0;
int result1 = EVP_EncryptUpdate(_ctx, data, &outlen, data, len); int result1 = EVP_EncryptUpdate(_ctx, data, &outlen, data, len);

View File

@@ -30,12 +30,12 @@ namespace Acore::Crypto
ARC4(); ARC4();
~ARC4(); ~ARC4();
void Init(uint8 const* seed, size_t len); void Init(uint8 const* seed, std::size_t len);
template <typename Container> template <typename Container>
void Init(Container const& c) { Init(std::data(c), std::size(c)); } 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> template <typename Container>
void UpdateData(Container& c) { UpdateData(std::data(c), std::size(c)); } 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; _initialized = true;
} }
void AuthCrypt::DecryptRecv(uint8* data, size_t len) void AuthCrypt::DecryptRecv(uint8* data, std::size_t len)
{ {
ASSERT(_initialized); ASSERT(_initialized);
_clientDecrypt.UpdateData(data, len); _clientDecrypt.UpdateData(data, len);
} }
void AuthCrypt::EncryptSend(uint8* data, size_t len) void AuthCrypt::EncryptSend(uint8* data, std::size_t len)
{ {
ASSERT(_initialized); ASSERT(_initialized);
_serverEncrypt.UpdateData(data, len); _serverEncrypt.UpdateData(data, len);

View File

@@ -27,8 +27,8 @@ public:
AuthCrypt() = default; AuthCrypt() = default;
void Init(SessionKey const& K); void Init(SessionKey const& K);
void DecryptRecv(uint8* data, size_t len); void DecryptRecv(uint8* data, std::size_t len);
void EncryptSend(uint8* data, size_t len); void EncryptSend(uint8* data, std::size_t len);
bool IsInitialized() const { return _initialized; } bool IsInitialized() const { return _initialized; }

View File

@@ -21,7 +21,7 @@
#include "Define.h" #include "Define.h"
#include <array> #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>; using SessionKey = std::array<uint8, SESSION_KEY_LENGTH>;
#endif #endif

View File

@@ -51,14 +51,14 @@ using SRP6 = Acore::Crypto::SRP6;
{ {
// split S into two buffers // split S into two buffers
std::array<uint8, EPHEMERAL_KEY_LENGTH / 2> buf0{}, buf1{}; 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]; buf0[i] = S[2 * i + 0];
buf1[i] = S[2 * i + 1]; buf1[i] = S[2 * i + 1];
} }
// find position of first nonzero byte // find position of first nonzero byte
size_t p = 0; std::size_t p = 0;
while (p < EPHEMERAL_KEY_LENGTH && !S[p]) while (p < EPHEMERAL_KEY_LENGTH && !S[p])
++p; ++p;
@@ -73,7 +73,7 @@ using SRP6 = Acore::Crypto::SRP6;
// stick the two hashes back together // stick the two hashes back together
SessionKey K; 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 + 0] = hash0[i];
K[2 * i + 1] = hash1[i]; K[2 * i + 1] = hash1[i];

View File

@@ -28,13 +28,13 @@ namespace Acore::Crypto
class AC_COMMON_API SRP6 class AC_COMMON_API SRP6
{ {
public: public:
static constexpr size_t SALT_LENGTH = 32; static constexpr std::size_t SALT_LENGTH = 32;
using Salt = std::array<uint8, SALT_LENGTH>; 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>; 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>; using EphemeralKey = std::array<uint8, EPHEMERAL_KEY_LENGTH>;
static std::array<uint8, 1> const g; static std::array<uint8, 1> const g;

View File

@@ -195,7 +195,7 @@ bool BigNumber::IsNegative() const
return BN_is_negative(_bn); 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 #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10100000L
int nBytes = GetNumBytes(); int nBytes = GetNumBytes();

View File

@@ -34,7 +34,7 @@ public:
BigNumber(int32 v) : BigNumber() { SetDword(v); } BigNumber(int32 v) : BigNumber() { SetDword(v); }
BigNumber(std::string const& v) : BigNumber() { SetHexStr(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(std::array<uint8, Size> const& v, bool littleEndian = true) : BigNumber() { SetBinary(v.data(), Size, littleEndian); }
~BigNumber(); ~BigNumber();
@@ -116,7 +116,7 @@ public:
[[nodiscard]] uint32 AsDword() const; [[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; [[nodiscard]] std::vector<uint8> ToByteVector(int32 minSize = 0, bool littleEndian = true) const;
template <std::size_t Size> template <std::size_t Size>

View File

@@ -18,15 +18,13 @@
#ifndef AZEROTHCORE_CRYPTO_CONSTANTS_H #ifndef AZEROTHCORE_CRYPTO_CONSTANTS_H
#define AZEROTHCORE_CRYPTO_CONSTANTS_H #define AZEROTHCORE_CRYPTO_CONSTANTS_H
#include "Define.h"
namespace Acore::Crypto namespace Acore::Crypto
{ {
struct Constants struct Constants
{ {
static constexpr size_t MD5_DIGEST_LENGTH_BYTES = 16; static constexpr std::size_t MD5_DIGEST_LENGTH_BYTES = 16;
static constexpr size_t SHA1_DIGEST_LENGTH_BYTES = 20; static constexpr std::size_t SHA1_DIGEST_LENGTH_BYTES = 20;
static constexpr size_t SHA256_DIGEST_LENGTH_BYTES = 32; 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) static void SplitFromBack(std::vector<uint8>& data, Container& tail)
{ {
ASSERT(data.size() >= std::size(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(); tail[N - i] = data.back();
data.pop_back(); data.pop_back();

View File

@@ -43,14 +43,14 @@ namespace Acore::Impl
#endif #endif
}; };
template <GenericHashImpl::HashCreator HashCreator, size_t DigestLength> template <GenericHashImpl::HashCreator HashCreator, std::size_t DigestLength>
class GenericHash class GenericHash
{ {
public: public:
static constexpr size_t DIGEST_LENGTH = DigestLength; static constexpr std::size_t DIGEST_LENGTH = DigestLength;
using Digest = std::array<uint8, DIGEST_LENGTH>; 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; GenericHash hash;
hash.UpdateData(data, len); hash.UpdateData(data, len);
@@ -112,7 +112,7 @@ namespace Acore::Impl
return *this; 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); int result = EVP_DigestUpdate(_ctx, data, len);
ASSERT(result == 1); ASSERT(result == 1);

View File

@@ -19,7 +19,7 @@
#include "Errors.h" #include "Errors.h"
#include <openssl/rand.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); 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?"); 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 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> template <typename Container>
void GetRandomBytes(Container& c) void GetRandomBytes(Container& c)
@@ -31,7 +31,7 @@ namespace Acore::Crypto
GetRandomBytes(std::data(c), std::size(c)); 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> GetRandomBytes()
{ {
std::array<uint8, S> arr; std::array<uint8, S> arr;

View File

@@ -29,15 +29,15 @@ class BigNumber;
namespace Acore::Impl namespace Acore::Impl
{ {
template <GenericHashImpl::HashCreator HashCreator, size_t DigestLength> template <GenericHashImpl::HashCreator HashCreator, std::size_t DigestLength>
class GenericHMAC class GenericHMAC
{ {
public: public:
static constexpr size_t DIGEST_LENGTH = DigestLength; static constexpr std::size_t DIGEST_LENGTH = DigestLength;
using Digest = std::array<uint8, DIGEST_LENGTH>; using Digest = std::array<uint8, DIGEST_LENGTH>;
template <typename Container> 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); GenericHMAC hash(seed);
hash.UpdateData(data, len); hash.UpdateData(data, len);
@@ -54,7 +54,7 @@ namespace Acore::Impl
return hash.GetDigest(); 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); int result = EVP_DigestSignInit(_ctx, nullptr, HashCreator(), nullptr, _key);
ASSERT(result == 1); ASSERT(result == 1);
@@ -105,7 +105,7 @@ namespace Acore::Impl
return *this; 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); int result = EVP_DigestSignUpdate(_ctx, data, len);
ASSERT(result == 1); ASSERT(result == 1);
@@ -120,7 +120,7 @@ namespace Acore::Impl
void Finalize() void Finalize()
{ {
size_t length = DIGEST_LENGTH; std::size_t length = DIGEST_LENGTH;
int result = EVP_DigestSignFinal(_ctx, _digest.data(), &length); int result = EVP_DigestSignFinal(_ctx, _digest.data(), &length);
ASSERT(result == 1); ASSERT(result == 1);
ASSERT(length == DIGEST_LENGTH); ASSERT(length == DIGEST_LENGTH);

View File

@@ -16,7 +16,6 @@
*/ */
#include "OpenSSLCrypto.h" #include "OpenSSLCrypto.h"
#include "Errors.h"
#include <openssl/crypto.h> // NOTE: this import is NEEDED (even though some IDEs report it as unused) #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 #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010000fL

View File

@@ -18,9 +18,6 @@
#ifndef AZEROTHCORE_SESSIONKEYGENERATOR_HPP #ifndef AZEROTHCORE_SESSIONKEYGENERATOR_HPP
#define AZEROTHCORE_SESSIONKEYGENERATOR_HPP #define AZEROTHCORE_SESSIONKEYGENERATOR_HPP
#include "CryptoHash.h"
#include <cstring>
template <typename Hash> template <typename Hash>
class SessionKeyGenerator class SessionKeyGenerator
{ {
@@ -30,8 +27,8 @@ public:
o0it(o0.begin()) o0it(o0.begin())
{ {
uint8 const* data = std::data(buf); uint8 const* data = std::data(buf);
size_t const len = std::size(buf); std::size_t const len = std::size(buf);
size_t const halflen = (len / 2); std::size_t const halflen = (len / 2);
o1 = Hash::GetDigestOf(data, halflen); o1 = Hash::GetDigestOf(data, halflen);
o2 = Hash::GetDigestOf(data + halflen, len - halflen); o2 = Hash::GetDigestOf(data + halflen, len - halflen);

View File

@@ -26,7 +26,7 @@ namespace Acore::Crypto
{ {
struct AC_COMMON_API TOTP 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>; using Secret = std::vector<uint8>;
static uint32 GenerateToken(Secret const& key, time_t timestamp); static uint32 GenerateToken(Secret const& key, time_t timestamp);

View File

@@ -120,7 +120,7 @@ DBCFileLoader::~DBCFileLoader()
delete[] fieldsOffset; delete[] fieldsOffset;
} }
DBCFileLoader::Record DBCFileLoader::getRecord(size_t id) DBCFileLoader::Record DBCFileLoader::getRecord(std::size_t id)
{ {
ASSERT(data); ASSERT(data);
return Record(*this, data + id * recordSize); return Record(*this, data + id * recordSize);

View File

@@ -46,7 +46,7 @@ public:
class Record class Record
{ {
public: public:
[[nodiscard]] float getFloat(size_t field) const [[nodiscard]] float getFloat(std::size_t field) const
{ {
ASSERT(field < file.fieldCount); ASSERT(field < file.fieldCount);
float val = *reinterpret_cast<float*>(offset + file.GetOffset(field)); float val = *reinterpret_cast<float*>(offset + file.GetOffset(field));
@@ -54,7 +54,7 @@ public:
return val; return val;
} }
[[nodiscard]] uint32 getUInt(size_t field) const [[nodiscard]] uint32 getUInt(std::size_t field) const
{ {
ASSERT(field < file.fieldCount); ASSERT(field < file.fieldCount);
uint32 val = *reinterpret_cast<uint32*>(offset + file.GetOffset(field)); uint32 val = *reinterpret_cast<uint32*>(offset + file.GetOffset(field));
@@ -62,16 +62,16 @@ public:
return val; return val;
} }
[[nodiscard]] uint8 getUInt8(size_t field) const [[nodiscard]] uint8 getUInt8(std::size_t field) const
{ {
ASSERT(field < file.fieldCount); ASSERT(field < file.fieldCount);
return *reinterpret_cast<uint8*>(offset + file.GetOffset(field)); 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); ASSERT(field < file.fieldCount);
size_t stringOffset = getUInt(field); std::size_t stringOffset = getUInt(field);
ASSERT(stringOffset < file.stringSize); ASSERT(stringOffset < file.stringSize);
return reinterpret_cast<char*>(file.stringTable + stringOffset); return reinterpret_cast<char*>(file.stringTable + stringOffset);
} }
@@ -85,12 +85,12 @@ public:
}; };
// Get record by id // Get record by id
Record getRecord(size_t id); Record getRecord(std::size_t id);
[[nodiscard]] uint32 GetNumRows() const { return recordCount; } [[nodiscard]] uint32 GetNumRows() const { return recordCount; }
[[nodiscard]] uint32 GetRowSize() const { return recordSize; } [[nodiscard]] uint32 GetRowSize() const { return recordSize; }
[[nodiscard]] uint32 GetCols() const { return fieldCount; } [[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; } [[nodiscard]] bool IsLoaded() const { return data != nullptr; }
char* AutoProduceData(char const* fmt, uint32& count, char**& indexTable); char* AutoProduceData(char const* fmt, uint32& count, char**& indexTable);
char* AutoProduceStrings(char const* fmt, char* dataTable); char* AutoProduceStrings(char const* fmt, char* dataTable);

View File

@@ -260,13 +260,13 @@ BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxco
return TRUE; return TRUE;
} }
template<size_t size> template<std::size_t size>
void ToTchar(wchar_t const* src, TCHAR (&dst)[size], std::true_type) void ToTchar(wchar_t const* src, TCHAR (&dst)[size], std::true_type)
{ {
wcstombs_s(nullptr, dst, src, size); 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) void ToTchar(wchar_t const* src, TCHAR (&dst)[size], std::false_type)
{ {
wcscpy_s(dst, src); wcscpy_s(dst, src);
@@ -1455,8 +1455,8 @@ void WheatyExceptionReport::FormatOutputValue(char* pszCurrBuffer,
BasicType basicType, BasicType basicType,
DWORD64 length, DWORD64 length,
PVOID pAddress, PVOID pAddress,
size_t bufferSize, std::size_t bufferSize,
size_t countOverride) std::size_t countOverride)
{ {
__try __try
{ {
@@ -1677,7 +1677,7 @@ void WheatyExceptionReport::PrintSymbolDetail()
} }
// Add appropriate indentation level (since this routine is recursive) // 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")); 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 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 BasicType GetBasicType(DWORD typeIndex, DWORD64 modBase);
static DWORD_PTR DereferenceUnsafePointer(DWORD_PTR address); static DWORD_PTR DereferenceUnsafePointer(DWORD_PTR address);

View File

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

View File

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

View File

@@ -18,12 +18,9 @@
#ifndef ACORE_OBJECTREGISTRY_H #ifndef ACORE_OBJECTREGISTRY_H
#define ACORE_OBJECTREGISTRY_H #define ACORE_OBJECTREGISTRY_H
#include "Define.h"
#include <map> #include <map>
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map>
#include <vector>
/** ObjectRegistry holds all registry item of the same type /** ObjectRegistry holds all registry item of the same type
*/ */

View File

@@ -23,12 +23,10 @@
* types of object at the same time. * types of object at the same time.
*/ */
#include "Define.h"
#include "Dynamic/TypeList.h" #include "Dynamic/TypeList.h"
#include "GridRefMgr.h" #include "GridRefMgr.h"
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>
#include <vector>
/* /*
* @class ContainerMapList is a mulit-type container for map elements * @class ContainerMapList is a mulit-type container for map elements
@@ -102,7 +100,7 @@ template<class OBJECT_TYPES>
class TypeMapContainer class TypeMapContainer
{ {
public: 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 /// inserts a specific object into the container
template<class SPECIFIC_TYPE> template<class SPECIFIC_TYPE>

View File

@@ -24,10 +24,7 @@
* to access or mutate the container. * to access or mutate the container.
*/ */
#include "Define.h"
#include "Dynamic/TypeList.h" #include "Dynamic/TypeList.h"
#include <map>
#include <unordered_map>
namespace Acore namespace Acore
{ {
@@ -159,31 +156,31 @@ namespace Acore
/* ContainerMapList Helpers */ /* ContainerMapList Helpers */
// count functions // count functions
template<class SPECIFIC_TYPE> 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(); return elements._element.getSize();
} }
template<class SPECIFIC_TYPE> 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; return 0;
} }
template<class SPECIFIC_TYPE, class T> 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; return 0;
} }
template<class SPECIFIC_TYPE, class T> 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); return Count(elements._elements, fake);
} }
template<class SPECIFIC_TYPE, class H, class T> 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); return Count(elements._TailElements, fake);
} }

View File

@@ -32,27 +32,27 @@ namespace Acore
{ {
/* ContainerMapList Helpers */ /* ContainerMapList Helpers */
// count functions // 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(); // 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; // 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; // 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); // 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); // return Count(elements._TailElements, fake);
// } // }

View File

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

View File

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

View File

@@ -19,6 +19,7 @@
#define APPENDERCONSOLE_H #define APPENDERCONSOLE_H
#include "Appender.h" #include "Appender.h"
#include <vector>
// EnumUtils: DESCRIBE THIS // EnumUtils: DESCRIBE THIS
enum ColorTypes 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) 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) if (dot_pos != std::string::npos)
{ {
_fileName.insert(dot_pos, sLog->GetLogsTimestamp()); _fileName.insert(dot_pos, sLog->GetLogsTimestamp());

View File

@@ -20,6 +20,7 @@
#include "Appender.h" #include "Appender.h"
#include <atomic> #include <atomic>
#include <vector>
class AppenderFile : public Appender 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); 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); std::string name = appenderName.substr(9);
if (size < 2) if (size < 2)
@@ -265,7 +265,7 @@ Logger const* Log::GetLoggerByType(std::string const& type) const
} }
std::string parentLogger = LOGGER_ROOT; 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) if (found != std::string::npos)
{ {
parentLogger = type.substr(0, found); parentLogger = type.substr(0, found);

View File

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

View File

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

View File

@@ -51,10 +51,10 @@ AC_API_EXPORT EnumText EnumUtils<ColorTypes>::ToString(ColorTypes value)
} }
template <> template <>
AC_API_EXPORT size_t EnumUtils<ColorTypes>::Count() { return 15; } AC_API_EXPORT std::size_t EnumUtils<ColorTypes>::Count() { return 15; }
template <> template <>
AC_API_EXPORT ColorTypes EnumUtils<ColorTypes>::FromIndex(size_t index) AC_API_EXPORT ColorTypes EnumUtils<ColorTypes>::FromIndex(std::size_t index)
{ {
switch (index) switch (index)
{ {
@@ -78,7 +78,7 @@ AC_API_EXPORT ColorTypes EnumUtils<ColorTypes>::FromIndex(size_t index)
} }
template <> template <>
AC_API_EXPORT size_t EnumUtils<ColorTypes>::ToIndex(ColorTypes value) AC_API_EXPORT std::size_t EnumUtils<ColorTypes>::ToIndex(ColorTypes value)
{ {
switch (value) switch (value)
{ {

View File

@@ -43,10 +43,10 @@ AC_API_EXPORT EnumText EnumUtils<LogLevel>::ToString(LogLevel value)
} }
template <> template <>
AC_API_EXPORT size_t EnumUtils<LogLevel>::Count() { return 7; } AC_API_EXPORT std::size_t EnumUtils<LogLevel>::Count() { return 7; }
template <> template <>
AC_API_EXPORT LogLevel EnumUtils<LogLevel>::FromIndex(size_t index) AC_API_EXPORT LogLevel EnumUtils<LogLevel>::FromIndex(std::size_t index)
{ {
switch (index) switch (index)
{ {
@@ -62,7 +62,7 @@ AC_API_EXPORT LogLevel EnumUtils<LogLevel>::FromIndex(size_t index)
} }
template <> template <>
AC_API_EXPORT size_t EnumUtils<LogLevel>::ToIndex(LogLevel value) AC_API_EXPORT std::size_t EnumUtils<LogLevel>::ToIndex(LogLevel value)
{ {
switch (value) switch (value)
{ {
@@ -94,10 +94,10 @@ AC_API_EXPORT EnumText EnumUtils<AppenderType>::ToString(AppenderType value)
} }
template <> template <>
AC_API_EXPORT size_t EnumUtils<AppenderType>::Count() { return 4; } AC_API_EXPORT std::size_t EnumUtils<AppenderType>::Count() { return 4; }
template <> template <>
AC_API_EXPORT AppenderType EnumUtils<AppenderType>::FromIndex(size_t index) AC_API_EXPORT AppenderType EnumUtils<AppenderType>::FromIndex(std::size_t index)
{ {
switch (index) switch (index)
{ {
@@ -110,7 +110,7 @@ AC_API_EXPORT AppenderType EnumUtils<AppenderType>::FromIndex(size_t index)
} }
template <> template <>
AC_API_EXPORT size_t EnumUtils<AppenderType>::ToIndex(AppenderType value) AC_API_EXPORT std::size_t EnumUtils<AppenderType>::ToIndex(AppenderType value)
{ {
switch (value) switch (value)
{ {
@@ -141,10 +141,10 @@ AC_API_EXPORT EnumText EnumUtils<AppenderFlags>::ToString(AppenderFlags value)
} }
template <> template <>
AC_API_EXPORT size_t EnumUtils<AppenderFlags>::Count() { return 6; } AC_API_EXPORT std::size_t EnumUtils<AppenderFlags>::Count() { return 6; }
template <> template <>
AC_API_EXPORT AppenderFlags EnumUtils<AppenderFlags>::FromIndex(size_t index) AC_API_EXPORT AppenderFlags EnumUtils<AppenderFlags>::FromIndex(std::size_t index)
{ {
switch (index) switch (index)
{ {
@@ -159,7 +159,7 @@ AC_API_EXPORT AppenderFlags EnumUtils<AppenderFlags>::FromIndex(size_t index)
} }
template <> template <>
AC_API_EXPORT size_t EnumUtils<AppenderFlags>::ToIndex(AppenderFlags value) AC_API_EXPORT std::size_t EnumUtils<AppenderFlags>::ToIndex(AppenderFlags value)
{ {
switch (value) switch (value)
{ {

View File

@@ -22,11 +22,9 @@
#include "Duration.h" #include "Duration.h"
#include "MPSCQueue.h" #include "MPSCQueue.h"
#include <functional> #include <functional>
#include <iosfwd>
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <utility>
#include <vector> #include <vector>
namespace Acore::Asio namespace Acore::Asio

View File

@@ -20,7 +20,6 @@
#include <atomic> #include <atomic>
#include <memory> #include <memory>
#include <utility>
namespace Acore::Impl namespace Acore::Impl
{ {

View File

@@ -18,11 +18,8 @@
#ifndef _PCQ_H #ifndef _PCQ_H
#define _PCQ_H #define _PCQ_H
#include <atomic>
#include <condition_variable> #include <condition_variable>
#include <mutex>
#include <queue> #include <queue>
#include <type_traits>
template <typename T> template <typename T>
class ProducerConsumerQueue class ProducerConsumerQueue
@@ -51,7 +48,7 @@ public:
return _queue.empty(); return _queue.empty();
} }
[[nodiscard]] size_t Size() const [[nodiscard]] std::size_t Size() const
{ {
return _queue.size(); return _queue.size();
} }

View File

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

View File

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

View File

@@ -27,7 +27,7 @@
namespace ByteConverter namespace ByteConverter
{ {
template<size_t T> template<std::size_t T>
inline void convert(char* val) inline void convert(char* val)
{ {
std::swap(*val, *(val + T - 1)); std::swap(*val, *(val + T - 1));

View File

@@ -17,7 +17,7 @@ template <typename T>
class CircularBuffer class CircularBuffer
{ {
public: public:
explicit CircularBuffer(size_t size) : explicit CircularBuffer(std::size_t size) :
buf_(std::unique_ptr<T[]>(new T[size])), buf_(std::unique_ptr<T[]>(new T[size])),
max_size_(size) max_size_(size)
{ {
@@ -52,14 +52,14 @@ public:
return full_; return full_;
} }
[[nodiscard]] size_t capacity() const [[nodiscard]] std::size_t capacity() const
{ {
return max_size_; 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_) if (!full_)
{ {
@@ -95,9 +95,9 @@ public:
private: private:
std::mutex mutex_; std::mutex mutex_;
std::unique_ptr<T[]> buf_; std::unique_ptr<T[]> buf_;
size_t head_ = 0; std::size_t head_ = 0;
size_t tail_ = 0; std::size_t tail_ = 0;
const size_t max_size_; const std::size_t max_size_;
bool full_ = false; bool full_ = false;
}; };
#endif #endif

View File

@@ -23,8 +23,6 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <stdexcept> #include <stdexcept>
#include <type_traits>
#include <utility>
#include <vector> #include <vector>
namespace Acore namespace Acore
@@ -51,13 +49,13 @@ namespace Acore
using reference = T&; using reference = T&;
using difference_type = std::ptrdiff_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; } T& operator*() const { check(); return *_buf; }
CheckedBufferOutputIterator& operator++() { check(); ++_buf; return *this; } CheckedBufferOutputIterator& operator++() { check(); ++_buf; return *this; }
CheckedBufferOutputIterator operator++(int) { CheckedBufferOutputIterator v = *this; operator++(); return v; } 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: private:
T* _buf; T* _buf;

View File

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

View File

@@ -24,9 +24,7 @@
#ifndef _ACORE_GEOMETRY_H #ifndef _ACORE_GEOMETRY_H
#define _ACORE_GEOMETRY_H #define _ACORE_GEOMETRY_H
#include "Define.h"
#include <cstdlib> #include <cstdlib>
#include <iostream>
#include <math.h> #include <math.h>
[[nodiscard]] inline float getAngle(float startX, float startY, float destX, float destY) [[nodiscard]] inline float getAngle(float startX, float startY, float destX, float destY)

View File

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

View File

@@ -58,7 +58,7 @@ inline T mean(Container&& c)
template <typename T> template <typename T>
inline T median(std::vector<T> a) 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 size of the arr[] is even
if (n % 2 == 0) if (n % 2 == 0)
{ {

View File

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

View File

@@ -86,7 +86,7 @@ double rand_chance()
return urd(engine); 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); std::discrete_distribution<uint32> dd(chances, chances + count);
return dd(engine); return dd(engine);

View File

@@ -47,7 +47,7 @@ AC_COMMON_API double rand_norm();
AC_COMMON_API double rand_chance(); 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 */ /* 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). */ /* Return true if a random roll fits in the specified chance (range 0-100). */
inline bool roll_chance_f(float chance) inline bool roll_chance_f(float chance)

View File

@@ -26,7 +26,7 @@
#include <mm_malloc.h> #include <mm_malloc.h>
#elif defined(__GNUC__) #elif defined(__GNUC__)
static __inline__ void *__attribute__((__always_inline__, __nodebug__, __malloc__)) 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) if (__align == 1)
{ {
@@ -78,7 +78,7 @@ uint32 SFMTRand::RandomUInt32() // Output random bits
return sfmt_genrand_uint32(&_state); 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); return _mm_malloc(size, 16);
} }
@@ -88,7 +88,7 @@ void SFMTRand::operator delete(void* ptr, std::nothrow_t const&)
_mm_free(ptr); _mm_free(ptr);
} }
void* SFMTRand::operator new(size_t size) void* SFMTRand::operator new(std::size_t size)
{ {
return _mm_malloc(size, 16); return _mm_malloc(size, 16);
} }
@@ -98,7 +98,7 @@ void SFMTRand::operator delete(void* ptr)
_mm_free(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); return _mm_malloc(size, 16);
} }
@@ -108,7 +108,7 @@ void SFMTRand::operator delete[](void* ptr, std::nothrow_t const&)
_mm_free(ptr); _mm_free(ptr);
} }
void* SFMTRand::operator new[](size_t size) void* SFMTRand::operator new[](std::size_t size)
{ {
return _mm_malloc(size, 16); return _mm_malloc(size, 16);
} }

View File

@@ -30,13 +30,13 @@ class SFMTRand
public: public:
SFMTRand(); SFMTRand();
uint32 RandomUInt32(); // Output random bits 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 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 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 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 delete[](void* ptr);
private: private:
sfmt_t _state; sfmt_t _state;

View File

@@ -37,10 +37,10 @@ namespace Acore::Impl::EnumUtilsImpl
template <typename Enum> template <typename Enum>
struct EnumUtils struct EnumUtils
{ {
static size_t Count(); static std::size_t Count();
static EnumText ToString(Enum value); static EnumText ToString(Enum value);
static Enum FromIndex(size_t index); static Enum FromIndex(std::size_t index);
static size_t ToIndex(Enum index); static std::size_t ToIndex(Enum index);
}; };
} }
@@ -48,11 +48,11 @@ class EnumUtils
{ {
public: public:
template <typename Enum> 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> template <typename Enum>
static EnumText ToString(Enum value) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToString(value); } static EnumText ToString(Enum value) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToString(value); }
template <typename Enum> 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> template <typename Enum>
static uint32 ToIndex(Enum value) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);} static uint32 ToIndex(Enum value) { return Acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);}
@@ -84,7 +84,7 @@ public:
using difference_type = std::ptrdiff_t; using difference_type = std::ptrdiff_t;
Iterator() : _index(EnumUtils::Count<Enum>()) {} 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 other._index == _index; }
bool operator!=(const Iterator& other) const { return !operator==(other); } bool operator!=(const Iterator& other) const { return !operator==(other); }

View File

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

View File

@@ -219,7 +219,7 @@ namespace Acore::Impl::StringConvertImpl
} }
tmp.append(str); tmp.append(str);
size_t n; std::size_t n;
T val = static_cast<T>(std::stold(tmp, &n)); T val = static_cast<T>(std::stold(tmp, &n));
if (n != tmp.length()) if (n != tmp.length())
{ {

View File

@@ -31,7 +31,7 @@ TaskScheduler& TaskScheduler::Update(success_t const& callback)
return *this; 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); return Update(std::chrono::milliseconds(milliseconds), callback);
} }

View File

@@ -19,14 +19,11 @@
#define _TASK_SCHEDULER_H_ #define _TASK_SCHEDULER_H_
#include "Util.h" #include "Util.h"
#include <algorithm>
#include <chrono> #include <chrono>
#include <functional> #include <functional>
#include <memory>
#include <optional> #include <optional>
#include <queue> #include <queue>
#include <set> #include <set>
#include <utility>
#include <vector> #include <vector>
class TaskContext; class TaskContext;
@@ -209,7 +206,7 @@ public:
/// Update the scheduler with a difftime in ms. /// Update the scheduler with a difftime in ms.
/// Calls the optional callback on successfully finish. /// 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. /// Update the scheduler with a difftime.
/// Calls the optional callback on successfully finish. /// 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; std::vector<std::string_view> tokens;
size_t start = 0; std::size_t start = 0;
for (size_t end = str.find(sep); end != std::string_view::npos; end = str.find(sep, start)) for (std::size_t end = str.find(sep); end != std::string_view::npos; end = str.find(sep, start))
{ {
if (keepEmpty || (start < end)) if (keepEmpty || (start < end))
{ {

View File

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

View File

@@ -48,7 +48,7 @@ namespace Acore
namespace Impl 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...>) T* new_from_tuple(Tuple&& args, std::index_sequence<I...>)
{ {
return new T(std::get<I>(std::forward<Tuple>(args))...); 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"; static std::string const invChars = " \t\7\n";
size_t wpos = 0; std::size_t wpos = 0;
bool space = false; 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) if (invChars.find(str[pos]) != std::string::npos)
{ {
@@ -242,7 +242,7 @@ uint32 GetPID()
return uint32(pid); return uint32(pid);
} }
size_t utf8length(std::string& utf8str) std::size_t utf8length(std::string& utf8str)
{ {
try 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 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) if (wlen <= len)
{ {
return; 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 try
{ {
@@ -330,7 +330,7 @@ bool Utf8toWStr(std::string_view utf8str, std::wstring& wstr)
return true; 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 try
{ {
@@ -512,14 +512,14 @@ void vutf8printf(FILE* out, const char* str, va_list* ap)
char temp_buf[32 * 1024]; char temp_buf[32 * 1024];
wchar_t wtemp_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 //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; 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); Utf8toWStr(temp_buf, temp_len, wtemp_buf, wtemp_len);
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], uint32(wtemp_len + 1)); CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], uint32(wtemp_len + 1));
@@ -542,7 +542,7 @@ bool Utf8ToUpperOnlyLatin(std::string& utf8String)
return WStrToUtf8(wstr, 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 init = 0;
int32 end = arrayLen; int32 end = arrayLen;
@@ -566,7 +566,7 @@ std::string Acore::Impl::ByteArrayToHexStr(uint8 const* bytes, size_t arrayLen,
return ss.str(); 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)); 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); AC_COMMON_API bool Utf8toWStr(std::string_view utf8str, std::wstring& wstr);
// in wsize==max size of buffer, out wsize==real string size // 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); 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); AC_COMMON_API bool WStrToUtf8(std::wstring_view wstr, std::string& utf8str);
// size==real string size // 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 // set string to "" if invalid utf8 sequence
size_t utf8length(std::string& utf8str); std::size_t utf8length(std::string& utf8str);
void utf8truncate(std::string& utf8str, size_t len); void utf8truncate(std::string& utf8str, std::size_t len);
inline bool isBasicLatinCharacter(wchar_t wchar) inline bool isBasicLatinCharacter(wchar_t wchar)
{ {
@@ -374,8 +374,8 @@ uint32 GetPID();
namespace Acore::Impl namespace Acore::Impl
{ {
AC_COMMON_API std::string ByteArrayToHexStr(uint8 const* bytes, size_t length, 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, size_t outlen, bool reverse = false); AC_COMMON_API void HexStrToByteArray(std::string_view str, uint8* out, std::size_t outlen, bool reverse = false);
} }
template<typename Container> template<typename Container>
@@ -384,13 +384,13 @@ std::string ByteArrayToHexStr(Container const& c, bool reverse = false)
return Acore::Impl::ByteArrayToHexStr(std::data(c), std::size(c), reverse); 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) void HexStrToByteArray(std::string_view str, std::array<uint8, Size>& buf, bool reverse = false)
{ {
Acore::Impl::HexStrToByteArray(str, buf.data(), Size, reverse); 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> HexStrToByteArray(std::string_view str, bool reverse = false)
{ {
std::array<uint8, Size> arr; std::array<uint8, Size> arr;
@@ -434,7 +434,7 @@ public:
m_list.remove(t); m_list.remove(t);
return *this; return *this;
} }
size_t size() std::size_t size()
{ {
return m_list.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) // Circle through realms in the RealmList and construct the return packet (including # of user characters in each realm)
ByteBuffer pkt; ByteBuffer pkt;
size_t RealmListSize = 0; std::size_t RealmListSize = 0;
for (auto const& [realmHandle, realm] : sRealmList->GetRealms()) for (auto const& [realmHandle, realm] : sRealmList->GetRealms())
{ {
// don't work with realms which not compatible with the client // don't work with realms which not compatible with the client

View File

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

View File

@@ -46,7 +46,7 @@ namespace Acore::Impl::Readline
static std::vector<std::string> vec; static std::vector<std::string> vec;
char* cli_unpack_vector(char const*, int state) char* cli_unpack_vector(char const*, int state)
{ {
static size_t i=0; static std::size_t i=0;
if (!state) if (!state)
i = 0; i = 0;
if (i < vec.size()) if (i < vec.size())

View File

@@ -94,7 +94,7 @@ int RASession::Send(std::string_view data)
{ {
std::ostream os(&_writeBuffer); std::ostream os(&_writeBuffer);
os << data; os << data;
size_t written = _socket.send(_writeBuffer.data()); std::size_t written = _socket.send(_writeBuffer.data());
_writeBuffer.consume(written); _writeBuffer.consume(written);
return written; return written;
} }
@@ -102,7 +102,7 @@ int RASession::Send(std::string_view data)
std::string RASession::ReadString() std::string RASession::ReadString()
{ {
boost::system::error_code error; 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) if (!read)
{ {
_socket.close(); _socket.close();

View File

@@ -26,7 +26,7 @@
using boost::asio::ip::tcp; 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> class RASession : public std::enable_shared_from_this<RASession>
{ {

View File

@@ -155,11 +155,11 @@ bool DatabaseWorkerPool<T>::PrepareStatements()
else else
connection->Unlock(); connection->Unlock();
size_t const preparedSize = connection->m_stmts.size(); std::size_t const preparedSize = connection->m_stmts.size();
if (_preparedStatementSize.size() < preparedSize) if (_preparedStatementSize.size() < preparedSize)
_preparedStatementSize.resize(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 // already set by another connection
// (each connection only has prepared statements of it's own type sync/async) // (each connection only has prepared statements of it's own type sync/async)
@@ -489,7 +489,7 @@ void DatabaseWorkerPool<T>::Enqueue(SQLOperation* op)
} }
template <class T> template <class T>
size_t DatabaseWorkerPool<T>::QueueSize() const std::size_t DatabaseWorkerPool<T>::QueueSize() const
{ {
return _queue->Size(); return _queue->Size();
} }

View File

@@ -227,7 +227,7 @@ public:
#endif #endif
} }
[[nodiscard]] size_t QueueSize() const; [[nodiscard]] std::size_t QueueSize() const;
private: private:
uint32 OpenConnections(InternalIndex type, uint8 numConnections); 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); 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); memcpy(buf, data.value, length);

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