projects
/
wxWidgets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a43a4f9
)
wxString::Truncates() now doesn't change the sharied copies of the string
author
Vadim Zeitlin
<vadim@wxwidgets.org>
Thu, 17 Dec 1998 20:23:13 +0000
(20:23 +0000)
committer
Vadim Zeitlin
<vadim@wxwidgets.org>
Thu, 17 Dec 1998 20:23:13 +0000
(20:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1226
c3d73ce0
-8a6f-49c7-b76d-
6d57e0e08775
src/common/string.cpp
patch
|
blob
|
blame
|
history
diff --git
a/src/common/string.cpp
b/src/common/string.cpp
index 749a952b349fc86d1800d7e0ec6c0a4c95983096..77026933c0abc56f22083cd9bd768ebad0d80d8e 100644
(file)
--- a/
src/common/string.cpp
+++ b/
src/common/string.cpp
@@
-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;
}