wxString::Truncates() now doesn't change the sharied copies of the string
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -899,8 +899,13 @@ wxString& wxString::Pad(size_t nCount, char chPad, bool bFromRight)
|
||||
// truncate the string
|
||||
wxString& wxString::Truncate(size_t uiLen)
|
||||
{
|
||||
*(m_pchData + uiLen) = '\0';
|
||||
GetStringData()->nDataLength = uiLen;
|
||||
if ( uiLen < Len() ) {
|
||||
CopyBeforeWrite();
|
||||
|
||||
*(m_pchData + uiLen) = '\0';
|
||||
GetStringData()->nDataLength = uiLen;
|
||||
}
|
||||
//else: nothing to do, string is already short enough
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user