// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_0 || BOOTSTRAP_NET_4_0
using System;
using System.Runtime.InteropServices;
namespace System.IO
{
+ [MonoTODO ("Offset is ignored")]
public class UnmanagedMemoryAccessor : IDisposable {
SafeBuffer buffer;
+#pragma warning disable 414
long offset;
+#pragma warning restore
long capacity;
bool canwrite, canread;
throw new ArgumentOutOfRangeException ("offset");
if (capacity < 0)
throw new ArgumentOutOfRangeException ("capacity");
- if (offset + capacity < 0)
- throw new InvalidOperationException ();
if (access == FileAccess.Read || access == FileAccess.ReadWrite)
canread = true;
throw new ArgumentOutOfRangeException ();
long left = capacity - position;
- var slots = (int)(left / Marshal.SizeOf (typeof (T)));
-
+ var slots = Math.Min (count, (int)(left / Marshal.SizeOf (typeof (T))));
+
buffer.ReadArray ((ulong) position, array, offset, slots);
return slots;
}
}
}
-#endif