1 // This may look like C code, but it is really -*- C++ -*-
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2004
5 // Implementation of Blob
8 #define MAGICKCORE_IMPLEMENTATION 1
9 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
11 #include "Magick++/Include.h"
12 #include "Magick++/Thread.h"
13 #include "Magick++/BlobRef.h"
18 // Implementation of Magick::BlobRef
21 // Construct with data, making private copy of data
22 Magick::BlobRef::BlobRef ( const void* data_,
26 _allocator(Magick::Blob::NewAllocator),
32 _data = new unsigned char[length_];
33 memcpy( _data, data_, length_ );
37 // Destructor (actually destroys data)
38 Magick::BlobRef::~BlobRef ( void )
40 if ( _allocator == Magick::Blob::NewAllocator )
42 delete [] static_cast<unsigned char*>(_data);
45 else if ( _allocator == Magick::Blob::MallocAllocator )
47 _data=(void *) RelinquishMagickMemory(_data);