From bebd4de14457fbbc7fd49900cfdc36c8d5efb755 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Tue, 7 Jul 2015 11:50:06 +0200 Subject: Fixed warnings generated by 64-bit MSVC. --- src/Protocol/CMakeLists.txt | 2 +- src/Protocol/Protocol18x.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Protocol') diff --git a/src/Protocol/CMakeLists.txt b/src/Protocol/CMakeLists.txt index fdc98b960..5adf6bd5e 100644 --- a/src/Protocol/CMakeLists.txt +++ b/src/Protocol/CMakeLists.txt @@ -29,7 +29,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set_source_files_properties(ChunkDataSerializer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast") set_source_files_properties(MojangAPI.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast") set_source_files_properties(Packetizer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast") - set_source_files_properties(Protocol18x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch-enum -Wno-error=switch -Wno-error=old-style-cast") + set_source_files_properties(Protocol18x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=sign-conversion -Wno-error=conversion -Wno-error=switch-enum -Wno-error=switch") set_source_files_properties(Protocol17x.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=old-style-cast") set_source_files_properties(ProtocolRecognizer.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=old-style-cast") endif() diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index d5dd328a4..99bba63e3 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -747,7 +747,7 @@ void cProtocol180::SendMapDecorators(int a_ID, const cMapDecoratorList & a_Decor cPacketizer Pkt(*this, 0x34); Pkt.WriteVarInt32(a_ID); Pkt.WriteBEUInt8(m_Scale); - Pkt.WriteVarInt32(a_Decorators.size()); + Pkt.WriteVarInt32(static_cast(a_Decorators.size())); for (cMapDecoratorList::const_iterator it = a_Decorators.begin(); it != a_Decorators.end(); ++it) { @@ -1715,7 +1715,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress // Compress the data: char CompressedData[MAX_COMPRESSED_PACKET_LEN]; - uLongf CompressedSize = compressBound(a_Packet.size()); + uLongf CompressedSize = compressBound(static_cast(a_Packet.size())); if (CompressedSize >= MAX_COMPRESSED_PACKET_LEN) { ASSERT(!"Too high packet size."); @@ -1724,7 +1724,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress int Status = compress2( reinterpret_cast(CompressedData), &CompressedSize, - reinterpret_cast(a_Packet.data()), a_Packet.size(), Z_DEFAULT_COMPRESSION + reinterpret_cast(a_Packet.data()), static_cast(a_Packet.size()), Z_DEFAULT_COMPRESSION ); if (Status != Z_OK) { @@ -1737,7 +1737,7 @@ bool cProtocol180::CompressPacket(const AString & a_Packet, AString & a_Compress Buffer.ReadAll(LengthData); Buffer.CommitRead(); - Buffer.WriteVarInt32(CompressedSize + LengthData.size()); + Buffer.WriteVarInt32(static_cast(CompressedSize + LengthData.size())); Buffer.WriteVarInt32(static_cast(a_Packet.size())); Buffer.ReadAll(LengthData); Buffer.CommitRead(); @@ -1910,7 +1910,7 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size) AString UncompressedData; if (m_State == 3) { - UInt32 NumBytesRead = m_ReceivedData.GetReadableSpace(); + UInt32 NumBytesRead = static_cast(m_ReceivedData.GetReadableSpace()); m_ReceivedData.ReadVarInt(CompressedSize); if (CompressedSize > PacketLen) { @@ -1926,11 +1926,11 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size) m_Client->Kick("Compression failure"); return; } - PacketLen = UncompressedData.size(); + PacketLen = static_cast(UncompressedData.size()); } else { - NumBytesRead -= m_ReceivedData.GetReadableSpace(); // How many bytes has the CompressedSize taken up? + NumBytesRead -= static_cast(m_ReceivedData.GetReadableSpace()); // How many bytes has the CompressedSize taken up? ASSERT(PacketLen > NumBytesRead); PacketLen -= NumBytesRead; } -- cgit v1.2.3