diff --git a/uppsrc/Core/BlockStream.cpp b/uppsrc/Core/BlockStream.cpp index 2cbd28510..e8145ac3d 100644 --- a/uppsrc/Core/BlockStream.cpp +++ b/uppsrc/Core/BlockStream.cpp @@ -19,8 +19,8 @@ void BlockStream::SetBufferSize(dword size) pagesize = 1 << n; pagemask = (uint64)-1 << n; if(buffer) - delete[] buffer; - buffer = new byte[pagesize]; + MemoryFree(buffer); + buffer = (byte *)MemoryAlloc(pagesize); pos = 0; ptr = rdlim = wrlim = buffer; pagepos = -1; @@ -36,7 +36,7 @@ BlockStream::BlockStream() BlockStream::~BlockStream() { if(buffer) - delete[] buffer; + MemoryFree(buffer); } int64 BlockStream::GetSize() const { diff --git a/uppsrc/Core/Stream.cpp b/uppsrc/Core/Stream.cpp index ab3a7c6f2..5a43d2e4d 100644 --- a/uppsrc/Core/Stream.cpp +++ b/uppsrc/Core/Stream.cpp @@ -1147,14 +1147,14 @@ void CompareStream::_Put(int w) { OutStream::OutStream() { const int bsz = 64 * 1024; - h = new byte[bsz]; + h = (byte *)MemoryAlloc(bsz); buffer = ptr = h; wrlim = h + bsz; } OutStream::~OutStream() { // Note: cannot call Close here ! - delete[] h; + MemoryFree(h); } void OutStream::_Put(int w) diff --git a/uppsrc/Core/Vcont.hpp b/uppsrc/Core/Vcont.hpp index 8030ff333..24e4ac370 100644 --- a/uppsrc/Core/Vcont.hpp +++ b/uppsrc/Core/Vcont.hpp @@ -672,7 +672,7 @@ String Array::ToString() const template void BiVector::ReAlloc(int newalloc) { ASSERT(items <= newalloc && items >= 0); - T *newvector = newalloc ? (T *) new byte[newalloc * sizeof(T)] : NULL; + T *newvector = newalloc ? (T *) MemoryAlloc(newalloc * sizeof(T)) : NULL; if(items) { int end = start + items; if(end <= alloc) @@ -681,7 +681,7 @@ void BiVector::ReAlloc(int newalloc) { memcpy((void *)newvector, (void *)(vector + start), (alloc - start) * sizeof(T)); memcpy((void *)(newvector + alloc - start), (void *)vector, (end - alloc) * sizeof(T)); } - delete[] (byte *)vector; + MemoryFree(vector); } vector = newvector; alloc = newalloc; @@ -745,7 +745,7 @@ void BiVector::Free() { Destroy(vector + start, vector + alloc); Destroy(vector, vector + end - alloc); } - delete[] (byte *)vector; + MemoryFree(vector); } } diff --git a/uppsrc/Core/z.cpp b/uppsrc/Core/z.cpp index dabfb79c3..24db8ecb1 100644 --- a/uppsrc/Core/z.cpp +++ b/uppsrc/Core/z.cpp @@ -17,12 +17,12 @@ namespace Upp { static voidpf zalloc_new(voidpf opaque, uInt items, uInt size) { - return new byte[items * size]; + return MemoryAlloc(items * size); } static void zfree_new(voidpf opaque, voidpf address) { - delete[] (byte *)address; + MemoryFree(address); } enum diff --git a/uppsrc/Painter/BufferPainter.h b/uppsrc/Painter/BufferPainter.h index 613793ac9..04668b938 100644 --- a/uppsrc/Painter/BufferPainter.h +++ b/uppsrc/Painter/BufferPainter.h @@ -7,13 +7,13 @@ class ClippingLine : NoCopy { byte *data; public: - void Clear() { if(!IsFull()) delete[] data; data = NULL; } - void Set(const byte *s, int len) { data = new byte[len]; memcpy(data, s, len); } - void SetFull() { ASSERT(!data); data = (byte *)1; } + void Clear() { if(!IsFull()) MemoryFree(data); data = NULL; } + void Set(const byte *s, int len) { data = (byte *)MemoryAlloc(len); memcpy(data, s, len); } + void SetFull() { ASSERT(!data); data = (byte *)1; } - bool IsEmpty() const { return !data; } - bool IsFull() const { return data == (byte *)1; } - operator const byte*() const { return data; } + bool IsEmpty() const { return !data; } + bool IsFull() const { return data == (byte *)1; } + operator const byte*() const { return data; } ClippingLine() { data = NULL; } ~ClippingLine() { Clear(); }