#endif
#include "wx/dynarray.h"
+#include <wx/intl.h>
#include <stdlib.h>
#include <string.h> // for memmove
// assignment operator
wxBaseArray& wxBaseArray::operator=(const wxBaseArray& src)
{
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
m_uiSize = // not src.m_uiSize to save memory
m_uiCount = src.m_uiCount;
else
{
// add 50% but not too much
- uint uiIncrement = m_uiSize >> 1;
+ uint uiIncrement = m_uiSize < WX_ARRAY_DEFAULT_INITIAL_SIZE
+ ? WX_ARRAY_DEFAULT_INITIAL_SIZE : m_uiSize >> 1;
if ( uiIncrement > ARRAY_MAXSIZE_INCREMENT )
uiIncrement = ARRAY_MAXSIZE_INCREMENT;
m_uiSize += uiIncrement;
// dtor
wxBaseArray::~wxBaseArray()
{
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
}
// clears the list
m_uiSize =
m_uiCount = 0;
- DELETEA(m_pItems);
- m_pItems = NULL;
+ wxDELETEA(m_pItems);
}
// pre-allocates memory (frees the previous data!)
// only if old buffer was not big enough
if ( uiSize > m_uiSize ) {
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
m_pItems = new long[uiSize];
m_uiSize = uiSize;
}
// add item at the given position
void wxBaseArray::Insert(long lItem, uint uiIndex)
{
- wxCHECK_RET( uiIndex <= m_uiCount, "bad index in wxArray::Insert" );
+ wxCHECK_RET( uiIndex <= m_uiCount, _("bad index in wxArray::Insert") );
Grow();
// removes item from array (by index)
void wxBaseArray::Remove(uint uiIndex)
{
- wxCHECK_RET( uiIndex <= m_uiCount, "bad index in wxArray::Remove" );
+ wxCHECK_RET( uiIndex <= m_uiCount, _("bad index in wxArray::Remove") );
memmove(&m_pItems[uiIndex], &m_pItems[uiIndex + 1],
(m_uiCount - uiIndex - 1)*sizeof(long));
int iIndex = Index(lItem);
wxCHECK_RET( iIndex != NOT_FOUND,
- "removing inexistent item in wxArray::Remove" );
+ _("removing inexistent item in wxArray::Remove") );
Remove((uint)iIndex);
}