summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ProtocolRecognizer.cpp
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-09-29 17:08:40 +0200
committerMattes D <github@xoft.cz>2015-10-02 17:26:53 +0200
commite1d5e5e165b3881eacf955d18cf3b2babd5a6113 (patch)
treef229227672d60a983213f8d1ba8ff5981086ca80 /src/Protocol/ProtocolRecognizer.cpp
parentRemove a pair of unused broken functions (diff)
downloadcuberite-e1d5e5e165b3881eacf955d18cf3b2babd5a6113.tar
cuberite-e1d5e5e165b3881eacf955d18cf3b2babd5a6113.tar.gz
cuberite-e1d5e5e165b3881eacf955d18cf3b2babd5a6113.tar.bz2
cuberite-e1d5e5e165b3881eacf955d18cf3b2babd5a6113.tar.lz
cuberite-e1d5e5e165b3881eacf955d18cf3b2babd5a6113.tar.xz
cuberite-e1d5e5e165b3881eacf955d18cf3b2babd5a6113.tar.zst
cuberite-e1d5e5e165b3881eacf955d18cf3b2babd5a6113.zip
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.cpp')
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp
index 0d16262f9..845e7b56d 100644
--- a/src/Protocol/ProtocolRecognizer.cpp
+++ b/src/Protocol/ProtocolRecognizer.cpp
@@ -200,10 +200,10 @@ void cProtocolRecognizer::SendDisconnect(const AString & a_Reason)
static const int Packet = 0xff; // PACKET_DISCONNECT
SendData(reinterpret_cast<const char *>(&Packet), 1); // WriteByte()
- AString UTF16 = UTF8ToRawBEUTF16(a_Reason.c_str(), a_Reason.length());
- static const u_short Size = htons(static_cast<u_short>(UTF16.size() / 2));
+ auto UTF16 = UTF8ToRawBEUTF16(a_Reason);
+ static const u_short Size = htons(static_cast<u_short>(UTF16.size()));
SendData(reinterpret_cast<const char *>(&Size), 2); // WriteShort()
- SendData(UTF16.data(), UTF16.size()); // WriteString()
+ SendData(reinterpret_cast<const char *>(UTF16.data()), UTF16.size() * sizeof(char16_t)); // WriteString()
}
}