aboutsummaryrefslogtreecommitdiff
path: root/src/shared/ByteBuffer.h
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-01 12:15:43 -0500
committermegamage <none@none>2009-06-01 12:15:43 -0500
commit11456447da10a3c96d74696a9bd003caebde9f7f (patch)
treead30e139765d11b8afbcddc9f0bad622b45a3c85 /src/shared/ByteBuffer.h
parent50015a1b4ee0082de09b0e0901b01b31b796a0e2 (diff)
[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
Diffstat (limited to 'src/shared/ByteBuffer.h')
-rw-r--r--src/shared/ByteBuffer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h
index 7dc6b5483df..f11746b8ce5 100644
--- a/src/shared/ByteBuffer.h
+++ b/src/shared/ByteBuffer.h
@@ -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++)