X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.IO%2FMemoryStream.cs;h=fa37add12026a3590b0800ab2bc6b28c1a056847;hb=5760f579fb341ebc89adef52db260d78535cb7da;hp=1e70a8e9a83a681fccde7d7dba15ca2c157bf5bb;hpb=ca1ca15642673854814f48dc4bef71dbb0f7a97c;p=mono.git diff --git a/mcs/class/corlib/System.IO/MemoryStream.cs b/mcs/class/corlib/System.IO/MemoryStream.cs index 1e70a8e9a83..fa37add1202 100644 --- a/mcs/class/corlib/System.IO/MemoryStream.cs +++ b/mcs/class/corlib/System.IO/MemoryStream.cs @@ -39,7 +39,7 @@ using System.Runtime.InteropServices; namespace System.IO { [Serializable] - [MonoTODO ("Fix serialization compatibility with MS.NET")] + [MonoTODO ("Serialization format not compatible with .NET")] public class MemoryStream : Stream { bool canWrite; @@ -336,15 +336,12 @@ namespace System.IO throw new ArgumentOutOfRangeException (); int newSize = (int) value + initialIndex; - if (newSize > capacity) { + if (newSize > capacity) Capacity = CalculateNewCapacity (newSize); - } - else if (newSize < length) { + else if (newSize < length) // zeroize present data (so we don't get it // back if we expand the stream using Seek) - for (int i = newSize; i < length; i++) - Buffer.SetByte (internalBuffer, i, 0); - } + Array.Clear (internalBuffer, newSize, length - newSize); length = newSize; if (position > length)