Stop using custom memory allocators.

Fix aliasing errors. Fixes issue 139 in trunk.
Fix build errors under OSX.
This commit is contained in:
castano
2010-10-06 02:56:35 +00:00
parent 06bf4ea960
commit df13c904b2
16 changed files with 318 additions and 339 deletions

View File

@ -138,13 +138,13 @@ void FloatImage::allocate(uint c, uint w, uint h)
m_height = h;
m_componentNum = c;
m_count = w * h * c;
m_mem = reinterpret_cast<float *>(nv::mem::malloc(m_count * sizeof(float)));
m_mem = malloc<float>(m_count);
}
/// Free the image, but don't clear the members.
void FloatImage::free()
{
nv::mem::free( reinterpret_cast<void *>(m_mem) );
::free(m_mem);
m_mem = NULL;
}
@ -152,7 +152,7 @@ void FloatImage::resizeChannelCount(uint c)
{
if (m_componentNum != c) {
uint count = m_width * m_height * c;
nv::mem::realloc(m_mem, count * sizeof(float));
realloc(m_mem, count * sizeof(float));
if (c > m_componentNum) {
memset(m_mem + m_count, 0, (count - m_count) * sizeof(float));

View File

@ -39,10 +39,10 @@ const Image & Image::operator=(const Image & img)
void Image::allocate(uint w, uint h)
{
free();
free();
m_width = w;
m_height = h;
m_data = (Color32 *)nv::mem::realloc(m_data, w * h * sizeof(Color32));
m_data = (Color32 *)realloc(m_data, w * h * sizeof(Color32));
}
bool Image::load(const char * name)
@ -80,7 +80,7 @@ void Image::unwrap()
void Image::free()
{
nv::mem::free(m_data);
::free(m_data);
m_data = NULL;
}