summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs')
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs47
1 files changed, 4 insertions, 43 deletions
diff --git a/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs b/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs
index d786326..165b6d2 100644
--- a/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs
+++ b/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs
@@ -17,7 +17,6 @@ using System.Runtime;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
-using System.Security.Permissions;
using System.Threading;
using System.Diagnostics;
using System.Diagnostics.Contracts;
@@ -108,25 +107,14 @@ namespace System.IO {
}
public UnmanagedMemoryStream(SafeBuffer buffer, long offset, long length) {
- Initialize(buffer, offset, length, FileAccess.Read, false);
+ Initialize(buffer, offset, length, FileAccess.Read);
}
public UnmanagedMemoryStream(SafeBuffer buffer, long offset, long length, FileAccess access) {
- Initialize(buffer, offset, length, access, false);
- }
-
- // We must create one of these without doing a security check. This
- // class is created while security is trying to start up. Plus, doing
- // a Demand from Assembly.GetManifestResourceStream isn't useful.
- internal UnmanagedMemoryStream(SafeBuffer buffer, long offset, long length, FileAccess access, bool skipSecurityCheck) {
- Initialize(buffer, offset, length, access, skipSecurityCheck);
+ Initialize(buffer, offset, length, access);
}
protected void Initialize(SafeBuffer buffer, long offset, long length, FileAccess access) {
- Initialize(buffer, offset, length, access, false);
- }
-
- internal void Initialize(SafeBuffer buffer, long offset, long length, FileAccess access, bool skipSecurityCheck) {
if (buffer == null) {
throw new ArgumentNullException(nameof(buffer));
}
@@ -147,11 +135,6 @@ namespace System.IO {
if (_isOpen) {
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
}
- if (!skipSecurityCheck) {
-#pragma warning disable 618
- new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
-#pragma warning restore 618
- }
// check for wraparound
unsafe {
@@ -181,31 +164,18 @@ namespace System.IO {
[CLSCompliant(false)]
public unsafe UnmanagedMemoryStream(byte* pointer, long length)
{
- Initialize(pointer, length, length, FileAccess.Read, false);
+ Initialize(pointer, length, length, FileAccess.Read);
}
[CLSCompliant(false)]
public unsafe UnmanagedMemoryStream(byte* pointer, long length, long capacity, FileAccess access)
{
- Initialize(pointer, length, capacity, access, false);
- }
-
- // We must create one of these without doing a security check. This
- // class is created while security is trying to start up. Plus, doing
- // a Demand from Assembly.GetManifestResourceStream isn't useful.
- internal unsafe UnmanagedMemoryStream(byte* pointer, long length, long capacity, FileAccess access, bool skipSecurityCheck)
- {
- Initialize(pointer, length, capacity, access, skipSecurityCheck);
+ Initialize(pointer, length, capacity, access);
}
[CLSCompliant(false)]
protected unsafe void Initialize(byte* pointer, long length, long capacity, FileAccess access)
{
- Initialize(pointer, length, capacity, access, false);
- }
-
- internal unsafe void Initialize(byte* pointer, long length, long capacity, FileAccess access, bool skipSecurityCheck)
- {
if (pointer == null)
throw new ArgumentNullException(nameof(pointer));
if (length < 0 || capacity < 0)
@@ -221,12 +191,6 @@ namespace System.IO {
if (_isOpen)
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
- if (!skipSecurityCheck) {
-#pragma warning disable 618
- new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
-#pragma warning restore 618
- }
-
_mem = pointer;
_offset = 0;
_length = length;
@@ -265,7 +229,6 @@ namespace System.IO {
if (!_isOpen) __Error.StreamIsClosed();
}
- [ComVisible(false)]
public override Task FlushAsync(CancellationToken cancellationToken) {
if (cancellationToken.IsCancellationRequested)
@@ -421,7 +384,6 @@ namespace System.IO {
return nInt;
}
- [ComVisible(false)]
public override Task<Int32> ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) {
if (buffer==null)
throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
@@ -618,7 +580,6 @@ namespace System.IO {
return;
}
- [ComVisible(false)]
public override Task WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) {
if (buffer==null)