[9616] Fix ByteBuffer::appendPackGUID appending a superfluous byte.

This commit is contained in:
QAston 2010-03-25 11:25:03 +01:00 committed by XTZGZoReX
parent 420429fdcf
commit f7e7e6b849
2 changed files with 11 additions and 10 deletions

View file

@ -385,21 +385,22 @@ class ByteBuffer
void appendPackGUID(uint64 guid) void appendPackGUID(uint64 guid)
{ {
if (_storage.size() < _wpos + sizeof(guid) + 1) uint8 packGUID[8+1];
_storage.resize(_wpos + sizeof(guid) + 1); packGUID[0] = 0;
size_t size = 1;
size_t mask_position = wpos(); for (uint8 i = 0; guid != 0; ++i)
*this << uint8(0);
for(uint8 i = 0; i < 8; ++i)
{ {
if(guid & 0xFF) if (guid & 0xFF)
{ {
_storage[mask_position] |= uint8(1 << i); packGUID[0] |= uint8(1 << i);
*this << uint8(guid & 0xFF); packGUID[size] = uint8(guid & 0xFF);
++size;
} }
guid >>= 8; guid >>= 8;
} }
append(packGUID, size);
} }
void put(size_t pos, const uint8 *src, size_t cnt) void put(size_t pos, const uint8 *src, size_t cnt)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9615" #define REVISION_NR "9616"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__