From 3a855f3f389f1d4b5ba4a7d77f6eb861f23d8d2b Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 27 Nov 2011 12:17:24 +0100 Subject: Core/PacketIO: Fixed memory leak in HandlePlayerLoginOpcode and cleaned some tabs -> spaces --- src/server/shared/Packets/ByteBuffer.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/server/shared/Packets/ByteBuffer.cpp') diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index cdb73987453..f495982ac14 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -48,7 +48,7 @@ template void BitStream::WriteBits(T value, size_t bits) for (int32 i = bits-1; i >= 0; --i) WriteBit((value >> i) & 1); } - + bool BitStream::Emtpy () { return _data.empty(); @@ -68,22 +68,22 @@ void BitStream::Print() { if (!sLog->IsOutDebug()) return; - std::stringstream ss; - ss << "BitStream: "; + std::stringstream ss; + ss << "BitStream: "; for (uint32 i = 0; i < GetLenght(); ++i) - ss << uint32(GetBit(i)) << " "; + ss << uint32(GetBit(i)) << " "; - sLog->outDebug(LOG_FILTER_NETWORKIO, ss.str().c_str()); + sLog->outDebug(LOG_FILTER_NETWORKIO, ss.str().c_str()); } ByteBuffer::ByteBuffer(size_t res, bool init): _rpos(0), _wpos(0), _bitpos(8), _curbitval(0) { if (init) { + _storage.resize(res); for (size_t i = 0; i < res; ++i) - { *this << uint8(0); - } - } else + } + else _storage.reserve(res); -} \ No newline at end of file +} -- cgit v1.2.3