From 772b57ca04b2dbe4ec163a8c2856f8af7bc5c2a5 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 18:00:10 +0200 Subject: Anvil saver pads data to 4K boundaries. Fixes #524. --- src/WorldStorage/WSSAnvil.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 33f34728e..f33178173 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -2672,6 +2672,11 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri return false; } + // 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)); + // Store the header: ChunkSize = (a_Data.size() + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size *up* to nearest 4KB sector, make it a sector number ASSERT(ChunkSize < 256); -- cgit v1.2.3 From a2cffb0363e42f12019712297e764a269b6a7d9a Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 1 May 2014 20:21:54 +0200 Subject: Fixed MSVC2013 compilation. --- src/Globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Globals.h b/src/Globals.h index a09819ce9..71e9191e4 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -272,7 +272,7 @@ template class SizeChecker; #if (defined(_MSC_VER) && (_MSC_VER < 1600)) // MSVC before 2010 doesn't have std::shared_ptr, but has std::tr1::shared_ptr, defined in included earlier #define SharedPtr std::tr1::shared_ptr -#elif (__cplusplus >= 201103L) +#elif (defined(_MSC_VER) || (__cplusplus >= 201103L)) // C++11 has std::shared_ptr in , included earlier #define SharedPtr std::shared_ptr #else -- cgit v1.2.3 From b0056cdcf8a36efbed4b97414ebf5741b56a5895 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:02:25 +0200 Subject: Removed the explicit copy constructor for cItem. The compiler generates an implicit one with the same contents and warns about it. The function left in for ToLua to generate the binding for it. --- src/Item.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/Item.h b/src/Item.h index 641c681db..8eb0a1f4e 100644 --- a/src/Item.h +++ b/src/Item.h @@ -73,6 +73,10 @@ public: } + // The constructor is disabled in code, because the compiler generates it anyway, + // but it needs to stay because ToLua needs to generate the binding for it + #if 0 + /** Creates an exact copy of the item */ cItem(const cItem & a_CopyFrom) : m_ItemType (a_CopyFrom.m_ItemType), @@ -85,6 +89,8 @@ public: { } + #endif + void Empty(void) { -- cgit v1.2.3