diff options
author | Samuel Barney <samjbarney@gmail.com> | 2015-07-09 19:15:37 +0200 |
---|---|---|
committer | Samuel Barney <samjbarney@gmail.com> | 2015-07-09 19:15:37 +0200 |
commit | aa94a275c603e7e8bd65cf1b7440017217a86c17 (patch) | |
tree | 325f7de76044dd8e120919c327d853e605d5828d /src/WorldStorage/WSSAnvil.cpp | |
parent | Network: Fixed ServerHandle's address formatting. (diff) | |
download | cuberite-aa94a275c603e7e8bd65cf1b7440017217a86c17.tar cuberite-aa94a275c603e7e8bd65cf1b7440017217a86c17.tar.gz cuberite-aa94a275c603e7e8bd65cf1b7440017217a86c17.tar.bz2 cuberite-aa94a275c603e7e8bd65cf1b7440017217a86c17.tar.lz cuberite-aa94a275c603e7e8bd65cf1b7440017217a86c17.tar.xz cuberite-aa94a275c603e7e8bd65cf1b7440017217a86c17.tar.zst cuberite-aa94a275c603e7e8bd65cf1b7440017217a86c17.zip |
Diffstat (limited to '')
-rwxr-xr-x | src/WorldStorage/WSSAnvil.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 8ca49c2c0..4912d20f6 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -130,7 +130,7 @@ cWSSAnvil::cWSSAnvil(cWorld * a_World, int a_CompressionFactor) : gzFile gz = gzopen((FILE_IO_PREFIX + fnam).c_str(), "wb"); if (gz != nullptr) { - gzwrite(gz, Writer.GetResult().data(), (unsigned)Writer.GetResult().size()); + gzwrite(gz, Writer.GetResult().data(), static_cast<unsigned>(Writer.GetResult().size())); } gzclose(gz); } @@ -497,7 +497,7 @@ bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_ a_Writer.AddByteArray("Data", BlockMetas + Y * SliceSizeNibble, SliceSizeNibble); a_Writer.AddByteArray("SkyLight", BlockSkyLight + Y * SliceSizeNibble, SliceSizeNibble); a_Writer.AddByteArray("BlockLight", BlockLight + Y * SliceSizeNibble, SliceSizeNibble); - a_Writer.AddByte("Y", (unsigned char)Y); + a_Writer.AddByte("Y", static_cast<unsigned char>(Y)); a_Writer.EndCompound(); } a_Writer.EndList(); // "Sections" @@ -3070,7 +3070,7 @@ bool cWSSAnvil::cMCAFile::GetChunkData(const cChunkCoords & a_Chunk, AString & a LOAD_FAILED(a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); return false; } - ChunkSize = ntohl((u_long)ChunkSize); + ChunkSize = ntohl(static_cast<u_long>(ChunkSize)); char CompressionType = 0; if (m_File.Read(&CompressionType, 1) != 1) { @@ -3122,7 +3122,7 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri // Store the chunk data: m_File.Seek(ChunkSector * 4096); - u_long ChunkSize = htonl((u_long)a_Data.size() + 1); + u_long ChunkSize = htonl(static_cast<u_long>(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()); @@ -3149,11 +3149,11 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri } // Store the header: - ChunkSize = ((u_long)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<u_long>(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.", - a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, (unsigned)(ChunkSize * 4) + a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, static_cast<unsigned>(ChunkSize * 4) ); return false; } |