diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2003-02-26 06:40:35 +0300 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2003-02-26 06:40:35 +0300 |
commit | 6d7b6e68dd8bf7ce48808ef5886881af5aa6dd18 (patch) | |
tree | 54a1f869e57e14dc1df884d98ebf9e2e04f697f0 /mcs/class/corlib/System.IO/MemoryStream.cs | |
parent | 99d0fb74a314fd52b82197af634ddac57e675c76 (diff) |
2003-02-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* MemoryStream.cs:
(ToArray): return only the portion of the buffer that contains
data, not the whole buffer. (note: this makes XmlDocument.Load work
again with documents that have a <?xml without the 'encoding'
attribute, which makes gtk-sharp generator work again).
svn path=/trunk/mcs/; revision=11979
Diffstat (limited to 'mcs/class/corlib/System.IO/MemoryStream.cs')
-rw-r--r-- | mcs/class/corlib/System.IO/MemoryStream.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mcs/class/corlib/System.IO/MemoryStream.cs b/mcs/class/corlib/System.IO/MemoryStream.cs index 8f5503ef9c4..3c45121b048 100644 --- a/mcs/class/corlib/System.IO/MemoryStream.cs +++ b/mcs/class/corlib/System.IO/MemoryStream.cs @@ -332,9 +332,9 @@ namespace System.IO { public virtual byte[] ToArray() {
- byte[] outBuffer = new byte[capacity];
+ byte[] outBuffer = new byte[(int)position];
- Buffer.BlockCopyInternal (internalBuffer, 0, outBuffer, 0, capacity);
+ Buffer.BlockCopyInternal (internalBuffer, 0, outBuffer, 0, (int)position);
return outBuffer;
}
|