From d2e8643607424cd74616e2e863f5609e7b8458a5 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 24 Aug 2016 21:45:03 +0200 Subject: Fixed type-casting-related warnings. --- src/WorldStorage/WSSAnvil.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/WorldStorage/WSSAnvil.cpp') diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 4fc855589..3fd104004 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -2882,8 +2882,7 @@ void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N case TAG_Byte: { // Vanilla uses this - unsigned char CollarColor = a_NBT.GetByte(CollarColorIdx); - Monster->SetCollarColor(CollarColor); + Monster->SetCollarColor(a_NBT.GetByte(CollarColorIdx)); break; } case TAG_Int: @@ -2892,6 +2891,11 @@ void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N Monster->SetCollarColor(a_NBT.GetInt(CollarColorIdx)); break; } + default: + { + // No other values are interpreted + break; + } } } @@ -3381,7 +3385,7 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri // Store the chunk data: m_File.Seek(static_cast(ChunkSector * 4096)); - u_long ChunkSize = htonl(static_cast(a_Data.size()) + 1); + UInt32 ChunkSize = htonl(static_cast(a_Data.size() + 1)); if (m_File.Write(&ChunkSize, 4) != 4) { LOGWARNING("Cannot save chunk [%d, %d], writing(1) data to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); @@ -3408,7 +3412,7 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri } // Store the header: - ChunkSize = (static_cast(a_Data.size()) + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size up to nearest 4KB sector, make it a sector number + ChunkSize = (static_cast(a_Data.size()) + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size up to nearest 4KB sector, make it a sector number if (ChunkSize > 255) { LOGWARNING("Cannot save chunk [%d, %d], the data is too large (%u KiB, maximum is 1024 KiB). Remove some entities and retry.", @@ -3418,10 +3422,10 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri } // Store the header info in the table - m_Header[LocalX + 32 * LocalZ] = htonl((ChunkSector << 8) | ChunkSize); + m_Header[LocalX + 32 * LocalZ] = htonl(static_cast((ChunkSector << 8) | ChunkSize)); // Set the modification time - m_TimeStamps[LocalX + 32 * LocalZ] = htonl(static_cast(time(nullptr))); + m_TimeStamps[LocalX + 32 * LocalZ] = htonl(static_cast(time(nullptr))); if (m_File.Seek(0) < 0) { -- cgit v1.2.3