From 84e7664513cdec1b23d505da95bd663b465b453e Mon Sep 17 00:00:00 2001 From: schodet Date: Sun, 27 Mar 2005 20:01:45 +0000 Subject: Utilisation plus judicieuse des operator new, etc... --- 2005/i/robert/src/image/image.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '2005/i/robert/src/image') diff --git a/2005/i/robert/src/image/image.cc b/2005/i/robert/src/image/image.cc index 99968c9..cee6690 100644 --- a/2005/i/robert/src/image/image.cc +++ b/2005/i/robert/src/image/image.cc @@ -95,7 +95,7 @@ Image::Rep::create (int width, int height, Image::PixelFormat pixelFormat) { unsigned bpp = Image::getBytePerPixel (pixelFormat); unsigned bufSize = Image::getBufSize (width, height, pixelFormat); - void *p = new uint8_t[bufSize * sizeof (uint8_t) + sizeof (Rep)]; + void *p = operator new[] (bufSize * sizeof (uint8_t) + sizeof (Rep)); Rep *rep = new (p) Rep; rep->width_ = width; rep->height_ = height; @@ -141,6 +141,7 @@ Image::Rep::release (void) void Image::Rep::destroy (void) { - delete[] reinterpret_cast (this); + this->~Rep (); + operator delete[] (this); } -- cgit v1.2.3