From 6f2ee27a0e2621a89e048fa40d358456046f1e14 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Sun, 20 Dec 2015 16:24:17 -0500 Subject: [PATCH] Fixed scoped allocator -- this should have never worked --- Base/include/FasTC/ScopedAllocator.h | 7 +------ IO/src/ImageLoaderKTX.cpp | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Base/include/FasTC/ScopedAllocator.h b/Base/include/FasTC/ScopedAllocator.h index 34e4c5d..e13f306 100644 --- a/Base/include/FasTC/ScopedAllocator.h +++ b/Base/include/FasTC/ScopedAllocator.h @@ -63,12 +63,7 @@ namespace FasTC { T *m_Ptr; ScopedAllocator() : m_Ptr(NULL) { } public: - static ScopedAllocator Create(uint32 nBytes) { - ScopedAllocator actr; - actr.m_Ptr = new T[nBytes]; - return actr; - } - + ScopedAllocator(uint32 nBytes) : m_Ptr(new T[nBytes]) { } ~ScopedAllocator() { if(m_Ptr) { delete [] m_Ptr; diff --git a/IO/src/ImageLoaderKTX.cpp b/IO/src/ImageLoaderKTX.cpp index f4ce1d5..003392b 100644 --- a/IO/src/ImageLoaderKTX.cpp +++ b/IO/src/ImageLoaderKTX.cpp @@ -205,8 +205,7 @@ bool ImageLoaderKTX::ReadData() { const uint8 *imgData = rdr.GetData() + bytesOfKeyValueData; while(rdr.GetData() < imgData) { LOAD(keyAndValueByteSize); - FasTC::ScopedAllocator keyValueData = - FasTC::ScopedAllocator::Create(keyAndValueByteSize); + FasTC::ScopedAllocator keyValueData(keyAndValueByteSize); if(!keyValueData) { fprintf(stderr, "KTX loader - out of memory.\n"); return false;