#ifndef WX_PRECOMP
#include "wx/defs.h"
#include "wx/string.h"
+#include <wx/intl.h>
#endif
#include <ctype.h>
// allocating extra space for each string consumes more memory but speeds up
// the concatenation operations (nLen is the current string's length)
-#define EXTRA_ALLOC 16
+// NB: EXTRA_ALLOC must be >= 0!
+#define EXTRA_ALLOC (19 - nLen % 16)
// ---------------------------------------------------------------------------
// static class variables definition
// assignment operator
wxArrayString& wxArrayString::operator=(const wxArrayString& src)
{
- Clear();
+ if ( m_nSize > 0 )
+ Clear();
- m_nSize = 0;
if ( src.m_nCount > ARRAY_DEFAULT_INITIAL_SIZE )
Alloc(src.m_nCount);
memcpy(pNew, m_pItems, m_nCount*sizeof(char *));
// delete old memory (but do not release the strings!)
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
m_pItems = pNew;
}
m_nSize =
m_nCount = 0;
- DELETEA(m_pItems);
- m_pItems = NULL;
+ wxDELETEA(m_pItems);
}
// dtor
{
Free();
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
}
// pre-allocates memory (frees the previous data!)
// only if old buffer was not big enough
if ( nSize > m_nSize ) {
Free();
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
m_pItems = new char *[nSize];
m_nSize = nSize;
}
{
wxASSERT( str.GetStringData()->IsValid() );
- wxCHECK_RET( nIndex <= m_nCount, "bad index in wxArrayString::Insert" );
+ wxCHECK_RET( nIndex <= m_nCount, ("bad index in wxArrayString::Insert") );
Grow();
// removes item from array (by index)
void wxArrayString::Remove(size_t nIndex)
{
- wxCHECK_RET( nIndex <= m_nCount, "bad index in wxArrayString::Remove" );
+ wxCHECK_RET( nIndex <= m_nCount, _("bad index in wxArrayString::Remove") );
// release our lock
Item(nIndex).GetStringData()->Unlock();
int iIndex = Index(sz);
wxCHECK_RET( iIndex != NOT_FOUND,
- "removing inexistent element in wxArrayString::Remove" );
+ _("removing inexistent element in wxArrayString::Remove") );
Remove((size_t)iIndex);
}
// sort array elements using passed comparaison function
-void wxArrayString::Sort(bool bCase, bool bReverse)
+void wxArrayString::Sort(bool WXUNUSED(bCase), bool WXUNUSED(bReverse) )
{
//@@@@ TO DO
//qsort(m_pItems, m_nCount, sizeof(char *), fCmp);