Core/Packets: Fixed exceptions being incorrectly thrown when appending empty strings to packets
Closes #5486 Closes #5495
This commit is contained in:
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user