corrected a bug in ConcatSelf() induced by the latest change

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-09-17 14:43:21 +00:00
parent 3c024cc22f
commit 054889057e

View File

@@ -441,9 +441,8 @@ void wxString::ConcatSelf(int nSrcLen, const char *pszSrcData)
{ {
STATISTICS_ADD(SummandLength, nSrcLen); STATISTICS_ADD(SummandLength, nSrcLen);
// concatenating an empty string is a NOP, but it happens quite rarely, // concatenating an empty string is a NOP
// so we don't waste our time checking for it if ( nSrcLen > 0 ) {
// if ( nSrcLen > 0 )
wxStringData *pData = GetStringData(); wxStringData *pData = GetStringData();
size_t nLen = pData->nDataLength; size_t nLen = pData->nDataLength;
size_t nNewLen = nLen + nSrcLen; size_t nNewLen = nLen + nSrcLen;
@@ -479,6 +478,8 @@ void wxString::ConcatSelf(int nSrcLen, const char *pszSrcData)
m_pchData[nNewLen] = '\0'; // put terminating '\0' m_pchData[nNewLen] = '\0'; // put terminating '\0'
GetStringData()->nDataLength = nNewLen; // and fix the length GetStringData()->nDataLength = nNewLen; // and fix the length
} }
//else: the string to append was empty
}
/* /*
* concatenation functions come in 5 flavours: * concatenation functions come in 5 flavours: