diff options
Diffstat (limited to 'src/server/authserver/Server/BattlenetBitStream.h')
-rw-r--r-- | src/server/authserver/Server/BattlenetBitStream.h | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/server/authserver/Server/BattlenetBitStream.h b/src/server/authserver/Server/BattlenetBitStream.h index 3d1d2d5f67d..e108f810e2b 100644 --- a/src/server/authserver/Server/BattlenetBitStream.h +++ b/src/server/authserver/Server/BattlenetBitStream.h @@ -23,36 +23,24 @@ #include <exception> #include <vector> #include <type_traits> -#include <ace/Auto_Ptr.h> -#include <ace/Stack_Trace.h> +#include <memory> namespace Battlenet { class BitStreamPositionException : public std::exception { - static uint32 const MessageSize = ACE_Stack_Trace::SYMBUFSIZ + 128; + static uint32 const MessageSize = 128; public: BitStreamPositionException(bool read, uint32 operationSize, uint32 position, uint32 streamSize) { memset(_message, 0, MessageSize); -#ifndef TRINITY_DEBUG - snprintf(_message, MessageSize, "Attempted to %s more bits (%u) %s stream than %s (%u)\nStack trace:\n", + snprintf(_message, MessageSize, "Attempted to %s more bits (%u) %s stream than %s (%u)\n", (read ? "read" : "write"), operationSize + position, (read ? "from" : "to"), (read ? "exist" : "allowed"), streamSize); -#else - ACE_Stack_Trace st(1); - snprintf(_message, MessageSize, "Attempted to %s more bits (%u) %s stream than %s (%u)\nStack trace:\n%s", - (read ? "read" : "write"), - operationSize + position, - (read ? "from" : "to"), - (read ? "exist" : "allowed"), - streamSize, - st.c_str()); -#endif } char const* what() const throw() @@ -67,7 +55,7 @@ namespace Battlenet class BitStream { public: - static uint32 const MaxSize = 0x1000; + static uint32 const MaxSize = 0x4000; // length : The maximum number of bytes to read BitStream(uint32 length) : _numBits(length * 8), _readPos(0), _writePos(0) @@ -95,13 +83,13 @@ namespace Battlenet return str; } - ACE_Auto_Array_Ptr<uint8> ReadBytes(uint32 count) + std::unique_ptr<uint8[]> ReadBytes(uint32 count) { AlignToNextByte(); if (_readPos + count * 8 > _numBits) throw BitStreamPositionException(true, count * 8, _readPos, _numBits); - ACE_Auto_Array_Ptr<uint8> buf(new uint8[count]); + std::unique_ptr<uint8[]> buf(new uint8[count]); memcpy(buf.get(), &_buffer[_readPos >> 3], count); _readPos += count * 8; return buf; @@ -243,4 +231,7 @@ namespace Battlenet }; } +template<> +bool Battlenet::BitStream::Read<bool>(uint32 bitCount); + #endif // __BATTLENETBITSTREAM_H__ |