summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-02-08 12:24:15 +0100
committerMattes D <github@xoft.cz>2015-02-08 12:24:15 +0100
commita939e2ded97730b7847593dab2b9abb849bd6555 (patch)
treecfc8b1d65a6c472af4ff59801d21549c108d7fa4 /src/WorldStorage/WSSAnvil.cpp
parentMerge pull request #1729 from mc-server/ReuseFlag (diff)
downloadcuberite-a939e2ded97730b7847593dab2b9abb849bd6555.tar
cuberite-a939e2ded97730b7847593dab2b9abb849bd6555.tar.gz
cuberite-a939e2ded97730b7847593dab2b9abb849bd6555.tar.bz2
cuberite-a939e2ded97730b7847593dab2b9abb849bd6555.tar.lz
cuberite-a939e2ded97730b7847593dab2b9abb849bd6555.tar.xz
cuberite-a939e2ded97730b7847593dab2b9abb849bd6555.tar.zst
cuberite-a939e2ded97730b7847593dab2b9abb849bd6555.zip
Diffstat (limited to 'src/WorldStorage/WSSAnvil.cpp')
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index a76e9461a..ae82db346 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -3136,8 +3136,11 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri
// Add padding to 4K boundary:
size_t BytesWritten = a_Data.size() + MCA_CHUNK_HEADER_LENGTH;
- static const char Padding[4095] = {0};
- m_File.Write(Padding, 4096 - (BytesWritten % 4096));
+ if (BytesWritten % 4096 != 0)
+ {
+ static const char Padding[4095] = {0};
+ m_File.Write(Padding, 4096 - (BytesWritten % 4096));
+ }
// 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