diff options
-rwxr-xr-x | mcs/class/corlib/System.Text/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/corlib/System.Text/StringBuilder.cs | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/mcs/class/corlib/System.Text/ChangeLog b/mcs/class/corlib/System.Text/ChangeLog index ab7b1da3d02..8ba8eaf2a08 100755 --- a/mcs/class/corlib/System.Text/ChangeLog +++ b/mcs/class/corlib/System.Text/ChangeLog @@ -1,3 +1,8 @@ +2005-01-31 Ben Maurer <bmaurer@ximian.com> + + * StringBuilder.cs (Remove): We need to do the check that the + string isnt being cached *before* we munge it. + 2005-01-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> * StringBuilder.cs: when creating the StringBuilder from a string, the diff --git a/mcs/class/corlib/System.Text/StringBuilder.cs b/mcs/class/corlib/System.Text/StringBuilder.cs index 3e7a3580ee5..9fcf317f9e1 100644 --- a/mcs/class/corlib/System.Text/StringBuilder.cs +++ b/mcs/class/corlib/System.Text/StringBuilder.cs @@ -229,15 +229,16 @@ namespace System.Text { // re-ordered to avoid possible integer overflow if (startIndex < 0 || length < 0 || startIndex > _length - length) throw new ArgumentOutOfRangeException(); - + + if (null != _cached_str) + InternalEnsureCapacity (_length); + // Copy everything after the 'removed' part to the start // of the removed part and truncate the sLength if (_length - (startIndex + length) > 0) String.InternalStrcpy (_str, startIndex, _str, startIndex + length, _length - (startIndex + length)); _length -= length; - if (null != _cached_str) - InternalEnsureCapacity (_length); return this; } |