Improved types of utf 16 strings
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user