aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-08-10 16:55:06 +0200
committerShauren <shauren.trinity@gmail.com>2012-08-10 16:55:06 +0200
commit348807794600d92d326ec6b7eaf544aac8eb2fc1 (patch)
tree20deed60ed0d877ebb9af37bfa93a13a0890f6a0 /src/server/shared
parent55171001ee76f5d0aae2d3675c87296da0e95684 (diff)
Core/PacketIO: Added WriteString method to ByteBuffer allowing to write strings without null-terminating them
Diffstat (limited to 'src/server/shared')
-rwxr-xr-xsrc/server/shared/Packets/ByteBuffer.h7
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(); }