Author: benm
Date: 2005-03-20 21:21:36 -0500 (Sun, 20 Mar 2005)
New Revision: 42039

Modified:
   trunk/mcs/class/corlib/System.Text/ChangeLog
   trunk/mcs/class/corlib/System.Text/StringBuilder.cs
Log:
2005-03-20  Ben Maurer  <[EMAIL PROTECTED]>

        * StringBuilder.cs (set_Length): If we set the length, we must
        clobber the cached string.

Modified: trunk/mcs/class/corlib/System.Text/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Text/ChangeLog        2005-03-20 22:41:42 UTC 
(rev 42038)
+++ trunk/mcs/class/corlib/System.Text/ChangeLog        2005-03-21 02:21:36 UTC 
(rev 42039)
@@ -1,3 +1,8 @@
+2005-03-20  Ben Maurer  <[EMAIL PROTECTED]>
+
+       * StringBuilder.cs (set_Length): If we set the length, we must
+       clobber the cached string.
+
 2005-03-03 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * UnicodeEncoding.cs: same fix (\uFEFF) but for Unicode. Patch by

Modified: trunk/mcs/class/corlib/System.Text/StringBuilder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Text/StringBuilder.cs 2005-03-20 22:41:42 UTC 
(rev 42038)
+++ trunk/mcs/class/corlib/System.Text/StringBuilder.cs 2005-03-21 02:21:36 UTC 
(rev 42039)
@@ -142,15 +142,16 @@
                                if (value == _length)
                                        return;
 
-                               if( value < _length ) 
-                               {
+                               if (value < _length) {
                                        // LAMESPEC:  The spec is unclear as to 
what to do
                                        // with the capacity when truncating 
the string.
 
                                        // Do as MS, keep the capacity
+                                       
+                                       // Make sure that we invalidate any 
cached string.
+                                       InternalEnsureCapacity (value);
                                        _length = value;
-                               } else 
-                               {
+                               } else {
                                        // Expand the capacity to the new 
length and
                                        // pad the string with spaces.
                                        

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to