summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ProtocolRecognizer.cpp
diff options
context:
space:
mode:
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()
}
}