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 MAGICK_IMPLEMENTATION
10
#include "Magick++/Include.h"
11
#include "Magick++/Thread.h"
12
#include "Magick++/BlobRef.h"
17
// Implementation of Magick::BlobRef
20
// Construct with data, making private copy of data
21
Magick::BlobRef::BlobRef ( const void* data_,
25
_allocator(Magick::Blob::NewAllocator),
31
_data = new unsigned char[length_];
32
memcpy( _data, data_, length_ );
36
// Destructor (actually destroys data)
37
Magick::BlobRef::~BlobRef ( void )
39
if ( _allocator == Magick::Blob::NewAllocator )
41
delete [] static_cast<unsigned char*>(_data);
44
else if ( _allocator == Magick::Blob::MallocAllocator )
46
LiberateMemory(static_cast<void **>(&_data));