#include <string.h>
#include <stdlib.h>
-#ifdef __SALFORDC__
- #include <clib.h>
-#endif
-
// allocating extra space for each string consumes more memory but speeds up
// the concatenation operations (nLen is the current string's length)
// NB: EXTRA_ALLOC must be >= 0!
{
if ( last >= first )
{
- InitWith(first, 0, last - first);
+ InitWith(first.GetPtr(), 0, last - first);
}
else
{
wxASSERT( nLen > 0 );
// make sure that we don't overflow
- wxASSERT( nLen < (INT_MAX / sizeof(wxStringCharType)) -
- (sizeof(wxStringData) + EXTRA_ALLOC + 1) );
+ wxCHECK( nLen < (INT_MAX / sizeof(wxStringCharType)) -
+ (sizeof(wxStringData) + EXTRA_ALLOC + 1), false );
STATISTICS_ADD(Length, nLen);
wxASSERT_MSG( nStart <= lenOld,
_T("index out of bounds in wxStringImpl::replace") );
size_t nEnd = nStart + nLen;
- if ( nEnd > lenOld )
+ if ( nLen > lenOld - nStart )
{
// nLen may be out of range, as it can be npos, just clump it down
nLen = lenOld - nStart;