From e1d5e5e165b3881eacf955d18cf3b2babd5a6113 Mon Sep 17 00:00:00 2001 From: tycho Date: Tue, 29 Sep 2015 16:08:40 +0100 Subject: Improved types of utf 16 strings --- src/Protocol/ProtocolRecognizer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Protocol') 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(&Packet), 1); // WriteByte() - AString UTF16 = UTF8ToRawBEUTF16(a_Reason.c_str(), a_Reason.length()); - static const u_short Size = htons(static_cast(UTF16.size() / 2)); + auto UTF16 = UTF8ToRawBEUTF16(a_Reason); + static const u_short Size = htons(static_cast(UTF16.size())); SendData(reinterpret_cast(&Size), 2); // WriteShort() - SendData(UTF16.data(), UTF16.size()); // WriteString() + SendData(reinterpret_cast(UTF16.data()), UTF16.size() * sizeof(char16_t)); // WriteString() } } -- cgit v1.2.3