diff options
author | Ovahlord <dreadkiller@gmx.de> | 2024-06-24 20:15:31 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-06-24 20:15:40 +0200 |
commit | c90e3fe1c23a37e516c34323a9e81dd1cd58bdfc (patch) | |
tree | 2c40330637fce037142d227174fe7cdb90afbeef /src/server/shared/Packets/ByteBuffer.cpp | |
parent | e3f27a5bebe1472841c4bb6d6d60831f50f89042 (diff) |
Core/Packets: ported ByteBuffer changes which had been sneaked in with 468a06baf046b716305ee665e3cfd93c80e99457
Diffstat (limited to 'src/server/shared/Packets/ByteBuffer.cpp')
-rw-r--r-- | src/server/shared/Packets/ByteBuffer.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index 8718a31d829..07a21a3e73a 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -29,19 +29,13 @@ ByteBuffer::ByteBuffer(MessageBuffer&& buffer) : _rpos(0), _wpos(0), _bitpos(Ini } ByteBufferPositionException::ByteBufferPositionException(size_t pos, size_t size, size_t valueSize) + : ByteBufferException(Trinity::StringFormat("Attempted to get value with size: {} in ByteBuffer (pos: {} size: {})", valueSize, pos, size)) { - std::ostringstream ss; - - ss << "Attempted to get value with size: " - << valueSize << " in ByteBuffer (pos: " << pos << " size: " << size - << ")"; - - message().assign(ss.str()); } ByteBufferInvalidValueException::ByteBufferInvalidValueException(char const* type, char const* value) + : ByteBufferException(Trinity::StringFormat("Invalid {} value ({}) found in ByteBuffer", type, value)) { - message().assign(Trinity::StringFormat("Invalid {} value ({}) found in ByteBuffer", type, value)); } ByteBuffer& ByteBuffer::operator>>(float& value) @@ -152,7 +146,7 @@ void ByteBuffer::print_storage() const o << "STORAGE_SIZE: " << size(); for (uint32 i = 0; i < size(); ++i) o << read<uint8>(i) << " - "; - o << " "; + o << ' '; TC_LOG_TRACE("network", "{}", o.str()); } @@ -170,7 +164,7 @@ void ByteBuffer::textlike() const snprintf(buf, 2, "%c", read<uint8>(i)); o << buf; } - o << " "; + o << ' '; TC_LOG_TRACE("network", "{}", o.str()); } @@ -187,7 +181,7 @@ void ByteBuffer::hexlike() const for (uint32 i = 0; i < size(); ++i) { char buf[4]; - snprintf(buf, 4, "%2X", read<uint8>(i)); + snprintf(buf, 4, "%02X", read<uint8>(i)); if ((i == (j * 8)) && ((i != (k * 16)))) { o << "| "; @@ -195,13 +189,13 @@ void ByteBuffer::hexlike() const } else if (i == (k * 16)) { - o << "\n"; + o << '\n'; ++k; ++j; } o << buf; } - o << " "; + o << ' '; TC_LOG_TRACE("network", "{}", o.str()); } |