From ad9243ebd06151e0efde6bcd0e7cfe9e9e2aa625 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 8 Mar 2010 19:39:54 +0300 Subject: [PATCH] [9550] Hide unsafe templated ByteBuffer::append function only for internal use. --- src/game/ObjectGuid.cpp | 2 +- src/shared/ByteBuffer.h | 13 +++++++------ src/shared/revision_nr.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/game/ObjectGuid.cpp b/src/game/ObjectGuid.cpp index 4c476fe2b..a6d7d993c 100644 --- a/src/game/ObjectGuid.cpp +++ b/src/game/ObjectGuid.cpp @@ -51,7 +51,7 @@ std::string ObjectGuid::GetString() const ByteBuffer& operator<< (ByteBuffer& buf, ObjectGuid const& guid) { - buf.append(guid.GetRawValue()); + buf << uint64(guid.GetRawValue()); return buf; } diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 26a74fb7e..f44cfb729 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -71,12 +71,6 @@ class ByteBuffer _rpos = _wpos = 0; } - template void append(T value) - { - EndianConvert(value); - append((uint8 *)&value, sizeof(value)); - } - template void put(size_t pos,T value) { EndianConvert(value); @@ -491,6 +485,13 @@ class ByteBuffer } sLog.outDebugInLine("\n"); } + private: + // limited for internal use because can "append" any unexpected type (like pointer and etc) with hard detection problem + template void append(T value) + { + EndianConvert(value); + append((uint8 *)&value, sizeof(value)); + } protected: size_t _rpos, _wpos; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index df50737b6..170d7e0e3 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9549" + #define REVISION_NR "9550" #endif // __REVISION_NR_H__