2010-01-14 Rolf Bjarne Kvinge <RKvinge@novell.com>
authorRolf Bjarne Kvinge <RKvinge@novell.com>
Thu, 14 Jan 2010 13:17:53 +0000 (13:17 -0000)
committerRolf Bjarne Kvinge <RKvinge@novell.com>
Thu, 14 Jan 2010 13:17:53 +0000 (13:17 -0000)
* UnmanagedMemoryStream.cs: Read: don't read bytes one-by-one, read all
at once.

svn path=/trunk/mcs/; revision=149555

mcs/class/corlib/System.IO/ChangeLog
mcs/class/corlib/System.IO/UnmanagedMemoryStream.cs

index e75015c252f7a6f913ccd9dea655fb9c13710fbb..c0e48a5addcc8c0aa009b5f37ac15a42c6160e39 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-14  Rolf Bjarne Kvinge  <RKvinge@novell.com>
+
+       * UnmanagedMemoryStream.cs: Read: don't read bytes one-by-one, read all
+       at once.
+
 2010-01-03  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * MemoryStream.cs: Don't clear the bytes beyond Length when shrinking
index f7a0b234999f4f3b283e6f6ed39ffdce614fc384..be61368094cff104a57d0930d1382d552450d0d2 100644 (file)
@@ -164,8 +164,8 @@ namespace System.IO
                                        return (0);
                                else {
                                        int progress = current_position + count < length ? count : (int) (length - current_position);
-                                       for (int i = 0; i < progress; i++)
-                                               buffer [offset + i] = Marshal.ReadByte (initial_pointer, (int) current_position++);
+                                       Marshal.Copy (new IntPtr (initial_pointer.ToInt64 () + current_position), buffer, offset, progress);
+                                       current_position += progress;
                                        return progress;
                                }
                        }