summaryrefslogtreecommitdiffstats
path: root/src/Protocol/ProtocolRecognizer.cpp
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2015-07-29 17:04:03 +0200
committerSamuel Barney <samjbarney@gmail.com>2015-07-29 17:49:30 +0200
commit804805d35a87c2acc9425d1762ad26b1ba2ec9ac (patch)
tree13b603c8bbf8177da92ce87f5413fb646d204f3f /src/Protocol/ProtocolRecognizer.cpp
parentMerge pull request #2376 from mjhanninen/fix-freebsd-build (diff)
downloadcuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.gz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.bz2
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.lz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.xz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.zst
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/ProtocolRecognizer.cpp12
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