summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-10-02 17:43:00 +0200
committerMattes D <github@xoft.cz>2015-10-02 17:43:00 +0200
commitc8019856973e0dbca9f1925bb4f163954250869e (patch)
treef229227672d60a983213f8d1ba8ff5981086ca80 /src/Protocol
parentMerge pull request #2511 from cuberite/BottomLayerSpawn (diff)
parentImproved types of utf 16 strings (diff)
downloadcuberite-c8019856973e0dbca9f1925bb4f163954250869e.tar
cuberite-c8019856973e0dbca9f1925bb4f163954250869e.tar.gz
cuberite-c8019856973e0dbca9f1925bb4f163954250869e.tar.bz2
cuberite-c8019856973e0dbca9f1925bb4f163954250869e.tar.lz
cuberite-c8019856973e0dbca9f1925bb4f163954250869e.tar.xz
cuberite-c8019856973e0dbca9f1925bb4f163954250869e.tar.zst
cuberite-c8019856973e0dbca9f1925bb4f163954250869e.zip
Diffstat (limited to '')
-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()
}
}