Stop using custom memory allocators.
Fix aliasing errors. Fixes issue 139 in trunk. Fix build errors under OSX.
This commit is contained in:
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user