mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2024-11-28 01:54:18 +01:00
Fixed scoped allocator -- this should have never worked
This commit is contained in:
parent
8a1906e7b7
commit
6f2ee27a0e
@ -63,12 +63,7 @@ namespace FasTC {
|
|||||||
T *m_Ptr;
|
T *m_Ptr;
|
||||||
ScopedAllocator() : m_Ptr(NULL) { }
|
ScopedAllocator() : m_Ptr(NULL) { }
|
||||||
public:
|
public:
|
||||||
static ScopedAllocator<T> Create(uint32 nBytes) {
|
ScopedAllocator<T>(uint32 nBytes) : m_Ptr(new T[nBytes]) { }
|
||||||
ScopedAllocator<T> actr;
|
|
||||||
actr.m_Ptr = new T[nBytes];
|
|
||||||
return actr;
|
|
||||||
}
|
|
||||||
|
|
||||||
~ScopedAllocator() {
|
~ScopedAllocator() {
|
||||||
if(m_Ptr) {
|
if(m_Ptr) {
|
||||||
delete [] m_Ptr;
|
delete [] m_Ptr;
|
||||||
|
@ -205,8 +205,7 @@ bool ImageLoaderKTX::ReadData() {
|
|||||||
const uint8 *imgData = rdr.GetData() + bytesOfKeyValueData;
|
const uint8 *imgData = rdr.GetData() + bytesOfKeyValueData;
|
||||||
while(rdr.GetData() < imgData) {
|
while(rdr.GetData() < imgData) {
|
||||||
LOAD(keyAndValueByteSize);
|
LOAD(keyAndValueByteSize);
|
||||||
FasTC::ScopedAllocator<uint8> keyValueData =
|
FasTC::ScopedAllocator<uint8> keyValueData(keyAndValueByteSize);
|
||||||
FasTC::ScopedAllocator<uint8>::Create(keyAndValueByteSize);
|
|
||||||
if(!keyValueData) {
|
if(!keyValueData) {
|
||||||
fprintf(stderr, "KTX loader - out of memory.\n");
|
fprintf(stderr, "KTX loader - out of memory.\n");
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user