diff options
author | Julian Laubstein <julianlaubstein@yahoo.de> | 2015-07-29 18:45:36 +0200 |
---|---|---|
committer | Julian Laubstein <julianlaubstein@yahoo.de> | 2015-07-29 18:45:36 +0200 |
commit | 735d590abf7f804a4504b70c84a289ba86c5f8e3 (patch) | |
tree | 13b603c8bbf8177da92ce87f5413fb646d204f3f /src/Protocol/ProtocolRecognizer.cpp | |
parent | Merge pull request #2376 from mjhanninen/fix-freebsd-build (diff) | |
parent | Silenced and fixed many warning messages across multiple files. (diff) | |
download | cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.gz cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.bz2 cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.lz cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.xz cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.zst cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.zip |
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.cpp')
-rw-r--r-- | src/Protocol/ProtocolRecognizer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 574875831..42c2eee0a 100644 --- a/src/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp @@ -258,11 +258,11 @@ void cProtocolRecognizer::SendDisconnect(const AString & a_Reason) { // This is used when the client sends a server-ping, respond with the default packet: static const int Packet = 0xff; // PACKET_DISCONNECT - SendData((const char *)&Packet, 1); // WriteByte() + SendData(reinterpret_cast<const char *>(&Packet), 1); // WriteByte() AString UTF16 = UTF8ToRawBEUTF16(a_Reason.c_str(), a_Reason.length()); - static const u_short Size = htons((u_short)(UTF16.size() / 2)); - SendData((const char *)&Size, 2); // WriteShort() + static const u_short Size = htons(static_cast<u_short>(UTF16.size() / 2)); + SendData(reinterpret_cast<const char *>(&Size), 2); // WriteShort() SendData(UTF16.data(), UTF16.size()); // WriteString() } } @@ -440,7 +440,7 @@ void cProtocolRecognizer::SendInventorySlot(char a_WindowID, short a_SlotNum, co -void cProtocolRecognizer::SendKeepAlive(int a_PingID) +void cProtocolRecognizer::SendKeepAlive(UInt32 a_PingID) { ASSERT(m_Protocol != nullptr); m_Protocol->SendKeepAlive(a_PingID); @@ -986,13 +986,13 @@ bool cProtocolRecognizer::TryRecognizeProtocol(void) // Lengthed protocol, try if it has the entire initial handshake packet: UInt32 PacketLen; - UInt32 ReadSoFar = (UInt32)m_Buffer.GetReadableSpace(); + UInt32 ReadSoFar = static_cast<UInt32>(m_Buffer.GetReadableSpace()); if (!m_Buffer.ReadVarInt(PacketLen)) { // Not enough bytes for the packet length, keep waiting return false; } - ReadSoFar -= (UInt32)m_Buffer.GetReadableSpace(); + ReadSoFar -= static_cast<UInt32>(m_Buffer.GetReadableSpace()); if (!m_Buffer.CanReadBytes(PacketLen)) { // Not enough bytes for the packet, keep waiting |