diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/shared/Packets/ByteBuffer.cpp | 22 | ||||
-rwxr-xr-x | src/server/shared/Packets/ByteBuffer.h | 12 |
2 files changed, 5 insertions, 29 deletions
diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp deleted file mode 100644 index a64bb926d04..00000000000 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "ByteBuffer.h" - -void ByteBufferException::PrintError() const -{ -} diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index e6fdcf0f202..f018eb31bb4 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -178,14 +178,17 @@ class ByteBuffer ByteBuffer &operator<<(const std::string &value) { - append((uint8 const*)value.c_str(), value.length()); + if (size_t len = value.length()) + append((uint8 const*)value.c_str(), len); append((uint8)0); return *this; } ByteBuffer &operator<<(const char *str) { - append((uint8 const*)str, str ? strlen(str) : 0); + size_t len = 0; + if (str && (len = strlen(str))) + append((uint8 const*)str, len); append((uint8)0); return *this; } @@ -372,11 +375,6 @@ class ByteBuffer _storage.reserve(ressize); } - void append(const std::string& str) - { - append((uint8 const*)str.c_str(), str.size() + 1); - } - void append(const char *src, size_t cnt) { return append((const uint8 *)src, cnt); |