diff options
| author | Shauren <shauren.trinity@gmail.com> | 2012-08-10 16:55:06 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2012-08-10 16:55:06 +0200 |
| commit | 348807794600d92d326ec6b7eaf544aac8eb2fc1 (patch) | |
| tree | 20deed60ed0d877ebb9af37bfa93a13a0890f6a0 /src/server/shared | |
| parent | 55171001ee76f5d0aae2d3675c87296da0e95684 (diff) | |
Core/PacketIO: Added WriteString method to ByteBuffer allowing to write strings without null-terminating them
Diffstat (limited to 'src/server/shared')
| -rwxr-xr-x | src/server/shared/Packets/ByteBuffer.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 5b7d335d0fa..4386ce03d42 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -452,6 +452,13 @@ class ByteBuffer return retval; } + //! Method for writing strings that have their length sent separately in packet + //! without null-terminating the string + void WriteString(std::string const& str) + { + append(str.c_str(), str.length()); + } + const uint8 *contents() const { return &_storage[0]; } size_t size() const { return _storage.size(); } |
