void wxStreamBuffer::FreeBuffer()
{
if ( m_destroybuf )
+ {
free(m_buffer_start);
+ m_buffer_start = NULL;
+ }
}
wxStreamBuffer::~wxStreamBuffer()
void wxStreamBuffer::SetBufferIO(size_t bufsize)
{
- // start by freeing the old buffer
- FreeBuffer();
-
if ( bufsize )
{
+ // this will free the old buffer and allocate the new one
SetBufferIO(malloc(bufsize), bufsize, true /* take ownership */);
}
else // no buffer size => no buffer
{
+ // still free the old one
+ FreeBuffer();
InitBuffer();
}
}
return 0;
const size_t len = wx_truncate_cast(size_t, length);
- wxASSERT_MSG( len == length, _T("large files not supported") );
+ wxASSERT_MSG( len == length + size_t(0), _T("large files not supported") );
return len;
}