Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -16,8 +16,9 @@ namespace System {
using System.Security;
[System.Runtime.InteropServices.ComVisible(true)]
public static class Buffer
public static partial class Buffer
{
#if !MONO
// Copies from one primitive array to another primitive array without
// respecting types. This calls memmove internally. The count and
// offset parameters here are in bytes. If you want to use traditional
@@ -27,7 +28,7 @@ namespace System {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern void BlockCopy(Array src, int srcOffset,
Array dst, int dstOffset, int count);
#endif
// A very simple and efficient memmove that assumes all of the
// parameter validation has already been done. The count and offset
// parameters here are in bytes. If you want to use traditional
@@ -35,7 +36,7 @@ namespace System {
[System.Security.SecuritySafeCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void InternalBlockCopy(Array src, int srcOffsetBytes,
internal static extern bool InternalBlockCopy(Array src, int srcOffsetBytes,
Array dst, int dstOffsetBytes, int byteCount);
// This is ported from the optimized CRT assembly in memchr.asm. The JIT generates
@@ -115,14 +116,14 @@ namespace System {
// If we don't have a match return -1;
return -1;
}
#if !MONO
// Returns a bool to indicate if the array is of primitive data types
// or not.
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern bool IsPrimitiveTypeArray(Array array);
#endif
// Gets a particular byte out of the array. The array must be an
// array of primitives.
//
@@ -133,7 +134,7 @@ namespace System {
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern byte _GetByte(Array array, int index);
#if !MONO
[System.Security.SecuritySafeCritical] // auto-generated
public static byte GetByte(Array array, int index)
{
@@ -151,7 +152,7 @@ namespace System {
return _GetByte(array, index);
}
#endif
// Sets a particular byte in an the array. The array must be an
// array of primitives.
//
@@ -162,7 +163,7 @@ namespace System {
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void _SetByte(Array array, int index, byte value);
#if !MONO
[System.Security.SecuritySafeCritical] // auto-generated
public static void SetByte(Array array, int index, byte value)
{
@@ -181,7 +182,7 @@ namespace System {
// Make the FCall to do the work
_SetByte(array, index, value);
}
#endif
// Gets a particular byte out of the array. The array must be an
// array of primitives.
@@ -193,7 +194,7 @@ namespace System {
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern int _ByteLength(Array array);
#if !MONO
[System.Security.SecuritySafeCritical] // auto-generated
public static int ByteLength(Array array)
{
@@ -207,7 +208,7 @@ namespace System {
return _ByteLength(array);
}
#endif
[System.Security.SecurityCritical] // auto-generated
internal unsafe static void ZeroMemory(byte* src, long len)
{
@@ -249,7 +250,7 @@ namespace System {
Memcpy(pDest + destIndex, pSrc + srcIndex, len);
}
}
#if !MONO
// This is tricky to get right AND fast, so lets make it useful for the whole Fx.
// E.g. System.Runtime.WindowsRuntime!WindowsRuntimeBufferExtensions.MemCopy uses it.
[FriendAccessAllowed]
@@ -491,5 +492,6 @@ namespace System {
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
extern private unsafe static void __Memcpy(byte* dest, byte* src, int len);
#endif // ARM
#endif
}
}