diff options
author | Shauren <shauren.trinity@gmail.com> | 2011-11-27 12:17:24 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2011-11-27 12:17:24 +0100 |
commit | 3a855f3f389f1d4b5ba4a7d77f6eb861f23d8d2b (patch) | |
tree | 5edf90bce1a2ecd37358927c91dbe29dafb50c3c /src/server/shared/Packets/ByteBuffer.cpp | |
parent | 70c3488dd0c5aa123cd1c15242add92187af7048 (diff) |
Core/PacketIO: Fixed memory leak in HandlePlayerLoginOpcode and cleaned some tabs -> spaces
Diffstat (limited to 'src/server/shared/Packets/ByteBuffer.cpp')
-rw-r--r-- | src/server/shared/Packets/ByteBuffer.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
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 <typename T> 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 +} |