[7929] Some fixes and optimizations for work with packet guids. Author: VladimirMangos

* Allocate only minimal required buffer size for object packet guid cache, avoid it realocation.
    * At adding aboyher buffer content copy only until wpos (really writed to buffer data)
    * In appendPackGUID check buffer size before data write.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-01 12:15:43 -05:00
parent 50015a1b4e
commit 11456447da
2 changed files with 6 additions and 4 deletions
+4 -1
View File
@@ -311,11 +311,14 @@ class ByteBuffer
}
void append(const ByteBuffer& buffer)
{
if(buffer.size()) append(buffer.contents(),buffer.size());
if(buffer.size()) append(buffer.contents(),buffer.wpos());
}
void appendPackGUID(uint64 guid)
{
if (_storage.size() < _wpos + sizeof(guid) + 1)
_storage.resize(_wpos + sizeof(guid) + 1);
size_t mask_position = wpos();
*this << uint8(0);
for(uint8 i = 0; i < 8; i++)