summaryrefslogtreecommitdiff
path: root/src/net/messageout.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-30 03:46:59 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-30 03:46:59 +0300
commitece00592ecd93f7a96db0ca82589d00846e2f938 (patch)
treec36bde1e1a46d11ee47438d0debaa8317cd0db6e /src/net/messageout.cpp
parentd14bb7a27ee23cc83b3af1db2f1976eaaa55d78a (diff)
parent2c3c118c03ece5cad2b73affffbcbbc5a5746c7a (diff)
downloadplus-ece00592ecd93f7a96db0ca82589d00846e2f938.tar.gz
plus-ece00592ecd93f7a96db0ca82589d00846e2f938.tar.bz2
plus-ece00592ecd93f7a96db0ca82589d00846e2f938.tar.xz
plus-ece00592ecd93f7a96db0ca82589d00846e2f938.zip
Merge branch 'master' into strippedstripped1.1.10.30
Diffstat (limited to 'src/net/messageout.cpp')
-rw-r--r--src/net/messageout.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index a8b66f5ae..f18f65a93 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -82,6 +82,34 @@ void MessageOut::writeString(const std::string &string, int length)
PacketCounters::incOutBytes(length);
}
+void MessageOut::writeStringNoLog(const std::string &string, int length)
+{
+ DEBUGLOG("writeString: ***");
+ int stringLength = static_cast<int>(string.length());
+ if (length < 0)
+ {
+ // Write the length at the start if not fixed
+ writeInt16(static_cast<short>(stringLength));
+ length = stringLength;
+ }
+ else if (length < stringLength)
+ {
+ // Make sure the length of the string is no longer than specified
+ stringLength = length;
+ }
+ expand(length);
+
+ // Write the actual string
+ memcpy(mData + mPos, string.c_str(), stringLength);
+
+ // Pad remaining space with zeros
+ if (length > stringLength)
+ memset(mData + mPos + stringLength, '\0', length - stringLength);
+
+ mPos += length;
+ PacketCounters::incOutBytes(length);
+}
+
char *MessageOut::getData() const
{
return mData;