From 210176fd915cf4ba16f428d3c1a249a71f4aa7a7 Mon Sep 17 00:00:00 2001 From: Treeston Date: Sun, 26 Jul 2020 01:53:34 +0200 Subject: Core/Authserver: Authserver cleanup (PR#25093) - Fix a handful of 1/256 bugs with most significant byte zero in BigNumber - Get rid of (most of) the C-style arrays in authserver - CryptoRandom as a unified source for cryptographic randomness - Bring our other crypto APIs into 2020 - BigNumber usability improvements - Authserver is now actually readable as a result of all of the above --- src/server/shared/Packets/ByteBuffer.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/server/shared/Packets') diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 549786f3aee..149545d10d6 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -20,6 +20,7 @@ #include "Define.h" #include "ByteConverter.h" +#include #include #include #include @@ -351,6 +352,12 @@ class TC_SHARED_API ByteBuffer _rpos += len; } + template + void read(std::array& arr) + { + read(arr.data(), Size); + } + void readPackGUID(uint64& guid) { if (rpos() + 1 > size()) @@ -438,6 +445,12 @@ class TC_SHARED_API ByteBuffer append(buffer.contents(), buffer.wpos()); } + template + void append(std::array const& arr) + { + append(arr.data(), Size); + } + // can be used in SMSG_MONSTER_MOVE opcode void appendPackXYZ(float x, float y, float z) { -- cgit v1.2.3