summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-06-14 20:05:02 +0200
committerTycho <work.tycho+git@gmail.com>2014-06-14 20:05:02 +0200
commit6b99e556462fdbdf6a265c014fb03f070b0f1b25 (patch)
tree96e70b12604c3a6733b15ee27083faff6543be92
parentfixed spaces (diff)
downloadcuberite-6b99e556462fdbdf6a265c014fb03f070b0f1b25.tar
cuberite-6b99e556462fdbdf6a265c014fb03f070b0f1b25.tar.gz
cuberite-6b99e556462fdbdf6a265c014fb03f070b0f1b25.tar.bz2
cuberite-6b99e556462fdbdf6a265c014fb03f070b0f1b25.tar.lz
cuberite-6b99e556462fdbdf6a265c014fb03f070b0f1b25.tar.xz
cuberite-6b99e556462fdbdf6a265c014fb03f070b0f1b25.tar.zst
cuberite-6b99e556462fdbdf6a265c014fb03f070b0f1b25.zip
-rw-r--r--src/AllocationPool.h11
-rw-r--r--src/Chunk.cpp2
-rw-r--r--src/Chunk.h2
-rw-r--r--src/ChunkData.cpp2
-rw-r--r--src/ChunkData.h7
-rw-r--r--src/ChunkMap.cpp2
-rw-r--r--src/ChunkMap.h2
-rw-r--r--tests/ChunkData/Coordinates.cpp2
8 files changed, 16 insertions, 14 deletions
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
index 9144c2eac..9bb44ff1f 100644
--- a/src/AllocationPool.h
+++ b/src/AllocationPool.h
@@ -4,7 +4,8 @@
#include <memory>
template<class T, size_t NumElementsInReserve>
-class cAllocationPool {
+class cAllocationPool
+{
public:
class cStarvationCallbacks
@@ -17,7 +18,7 @@ class cAllocationPool {
};
cAllocationPool(std::auto_ptr<cStarvationCallbacks> a_Callbacks) :
- m_Callbacks(a_Callbacks)
+ m_Callbacks(a_Callbacks)
{
for (size_t i = 0; i < NumElementsInReserve; i++)
{
@@ -40,7 +41,7 @@ class cAllocationPool {
}
}
- T* Allocate()
+ T * Allocate()
{
if (m_FreeList.size() <= NumElementsInReserve)
{
@@ -61,11 +62,11 @@ class cAllocationPool {
}
}
// placement new, used to initalize the object
- T* ret = new (m_FreeList.front()) T;
+ T * ret = new (m_FreeList.front()) T;
m_FreeList.pop_front();
return ret;
}
- void Free(T* ptr)
+ void Free(T * ptr)
{
if (ptr == NULL)
{
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 64a5660d8..a0a397a08 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -65,7 +65,7 @@ cChunk::cChunk(
int a_ChunkX, int a_ChunkY, int a_ChunkZ,
cChunkMap * a_ChunkMap, cWorld * a_World,
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP,
- cAllocationPool<cChunkData::sChunkSection,1600>& a_Pool
+ cAllocationPool<cChunkData::sChunkSection, 1600> & a_Pool
) :
m_IsValid(false),
m_IsLightValid(false),
diff --git a/src/Chunk.h b/src/Chunk.h
index 7309fd022..07f597d59 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -66,7 +66,7 @@ public:
int a_ChunkX, int a_ChunkY, int a_ChunkZ, // Chunk coords
cChunkMap * a_ChunkMap, cWorld * a_World, // Parent objects
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP, // Neighbor chunks
- cAllocationPool<cChunkData::sChunkSection,1600>& a_Pool
+ cAllocationPool<cChunkData::sChunkSection, 1600> & a_Pool
);
cChunk(cChunk & other);
~cChunk();
diff --git a/src/ChunkData.cpp b/src/ChunkData.cpp
index d2903cff1..f9c263d88 100644
--- a/src/ChunkData.cpp
+++ b/src/ChunkData.cpp
@@ -27,7 +27,7 @@ template <typename T> inline bool IsAllValue(const T * a_Array, size_t a_NumElem
-cChunkData::cChunkData(cAllocationPool<cChunkData::sChunkSection, 1600>& a_Pool) :
+cChunkData::cChunkData(cAllocationPool<cChunkData::sChunkSection, 1600> & a_Pool) :
#if __cplusplus < 201103L
// auto_ptr style interface for memory management
m_IsOwner(true),
diff --git a/src/ChunkData.h b/src/ChunkData.h
index aaefc4575..9dee78ad0 100644
--- a/src/ChunkData.h
+++ b/src/ChunkData.h
@@ -37,7 +37,7 @@ public:
struct sChunkSection;
- cChunkData(cAllocationPool<cChunkData::sChunkSection, 1600>& a_Pool);
+ cChunkData(cAllocationPool<cChunkData::sChunkSection, 1600> & a_Pool);
~cChunkData();
#if __cplusplus < 201103L
@@ -96,7 +96,8 @@ public:
Allows a_Src to be NULL, in which case it doesn't do anything. */
void SetSkyLight(const NIBBLETYPE * a_Src);
- struct sChunkSection {
+ struct sChunkSection
+ {
BLOCKTYPE m_BlockTypes [SectionHeight * 16 * 16] ;
NIBBLETYPE m_BlockMetas [SectionHeight * 16 * 16 / 2];
NIBBLETYPE m_BlockLight [SectionHeight * 16 * 16 / 2];
@@ -121,7 +122,7 @@ private:
/** Sets the data in the specified section to their default values. */
void ZeroSection(sChunkSection * a_Section) const;
- cAllocationPool<cChunkData::sChunkSection, 1600>& m_Pool;
+ cAllocationPool<cChunkData::sChunkSection, 1600> & m_Pool;
};
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 862d0b7ec..704c4f823 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -2672,7 +2672,7 @@ void cChunkMap::QueueTickBlock(int a_BlockX, int a_BlockY, int a_BlockZ)
// cChunkMap::cChunkLayer:
cChunkMap::cChunkLayer::cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Parent,
- cAllocationPool<cChunkData::sChunkSection,1600>& a_Pool)
+ cAllocationPool<cChunkData::sChunkSection, 1600> & a_Pool)
: m_LayerX( a_LayerX )
, m_LayerZ( a_LayerZ )
, m_Parent( a_Parent )
diff --git a/src/ChunkMap.h b/src/ChunkMap.h
index 071921f92..08156e7e6 100644
--- a/src/ChunkMap.h
+++ b/src/ChunkMap.h
@@ -352,7 +352,7 @@ private:
{
public:
cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Parent,
- cAllocationPool<cChunkData::sChunkSection, 1600>& a_Pool);
+ cAllocationPool<cChunkData::sChunkSection, 1600> & a_Pool);
~cChunkLayer();
/** Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check */
diff --git a/tests/ChunkData/Coordinates.cpp b/tests/ChunkData/Coordinates.cpp
index 66fab46ab..1ac600f82 100644
--- a/tests/ChunkData/Coordinates.cpp
+++ b/tests/ChunkData/Coordinates.cpp
@@ -144,7 +144,7 @@ int main(int argc, char** argv)
#else
copy = std::move(copy);
#endif
- testassert(copy.GetBlock(0,0,0) == 0x42);
+ testassert(copy.GetBlock(0, 0, 0) == 0x42);
}
return 0;