Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public virtual int Capacity
object[] newItems = new object[value];
if (_size > 0)
{
Array.Copy(_items, 0, newItems, 0, _size);
Array.Copy(_items, newItems, _size);
}
_items = newItems;
}
Expand Down Expand Up @@ -248,7 +248,7 @@ public virtual object Clone()
ArrayList la = new ArrayList(_size);
la._size = _size;
la._version = _version;
Array.Copy(_items, 0, la._items, 0, _size);
Array.Copy(_items, la._items, _size);
return la;
}

Expand Down Expand Up @@ -714,7 +714,7 @@ public static ArrayList Synchronized(ArrayList list)
return Array.Empty<object>();

object?[] array = new object[_size];
Array.Copy(_items, 0, array, 0, _size);
Array.Copy(_items, array, _size);
return array;
}

Expand All @@ -729,7 +729,7 @@ public virtual Array ToArray(Type type)
throw new ArgumentNullException(nameof(type));

Array array = Array.CreateInstance(type, _size);
Array.Copy(_items, 0, array, 0, _size);
Array.Copy(_items, array, _size);
return array;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ private void Resize(int newSize, bool forceNewHashCodes)
Entry[] entries = new Entry[newSize];

int count = _count;
Array.Copy(_entries, 0, entries, 0, count);
Array.Copy(_entries, entries, count);

if (default(TKey)! == null && forceNewHashCodes) // TODO-NULLABLE: default(T) == null warning (https://github.com/dotnet/roslyn/issues/34757)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public int Capacity
T[] newItems = new T[value];
if (_size > 0)
{
Array.Copy(_items, 0, newItems, 0, _size);
Array.Copy(_items, newItems, _size);
}
_items = newItems;
}
Expand Down Expand Up @@ -1035,7 +1035,7 @@ public T[] ToArray()
}

T[] array = new T[_size];
Array.Copy(_items, 0, array, 0, _size);
Array.Copy(_items, array, _size);
return array;
}

Expand Down
12 changes: 6 additions & 6 deletions src/System.Private.CoreLib/shared/System/DefaultBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public sealed override MethodBase BindToMethod(
{
object[] objs = new object[parms.Length];
int lastPos = parms.Length - 1;
Array.Copy(args, 0, objs, 0, lastPos);
Array.Copy(args, objs, lastPos);
objs[lastPos] = Array.CreateInstance(paramArrayTypes[0], 1);
((Array)objs[lastPos]).SetValue(args[lastPos], 0);
args = objs;
Expand Down Expand Up @@ -334,7 +334,7 @@ public sealed override MethodBase BindToMethod(
{
object[] objs = new object[parms.Length];
int paramArrayPos = parms.Length - 1;
Array.Copy(args, 0, objs, 0, paramArrayPos);
Array.Copy(args, objs, paramArrayPos);
objs[paramArrayPos] = Array.CreateInstance(paramArrayTypes[0], args.Length - paramArrayPos);
Array.Copy(args, paramArrayPos, (System.Array)objs[paramArrayPos], 0, args.Length - paramArrayPos);
args = objs;
Expand Down Expand Up @@ -384,7 +384,7 @@ public sealed override MethodBase BindToMethod(
{
object[] objs = new object[parameters.Length];
int lastPos = parameters.Length - 1;
Array.Copy(args, 0, objs, 0, lastPos);
Array.Copy(args, objs, lastPos);
objs[lastPos] = Array.CreateInstance(paramArrayTypes[currentMin], 1);
((Array)objs[lastPos]).SetValue(args[lastPos], 0);
args = objs;
Expand Down Expand Up @@ -417,7 +417,7 @@ public sealed override MethodBase BindToMethod(
{
object[] objs = new object[parameters.Length];
int paramArrayPos = parameters.Length - 1;
Array.Copy(args, 0, objs, 0, paramArrayPos);
Array.Copy(args, objs, paramArrayPos);
objs[paramArrayPos] = Array.CreateInstance(paramArrayTypes[currentMin], args.Length - paramArrayPos);
Array.Copy(args, paramArrayPos, (System.Array)objs[paramArrayPos], 0, args.Length - paramArrayPos);
args = objs;
Expand Down Expand Up @@ -750,7 +750,7 @@ public sealed override void ReorderArgumentArray(ref object?[] args, object stat
{
// must be args.Length < state.originalSize
object[] newArgs = new object[args.Length];
Array.Copy(args, 0, newArgs, 0, paramArrayPos);
Array.Copy(args, newArgs, paramArrayPos);
for (int i = paramArrayPos, j = 0; i < newArgs.Length; i++, j++)
{
newArgs[i] = ((object[])args[paramArrayPos]!)[j];
Expand All @@ -763,7 +763,7 @@ public sealed override void ReorderArgumentArray(ref object?[] args, object stat
if (args.Length > binderState._originalSize)
{
object[] newArgs = new object[binderState._originalSize];
Array.Copy(args, 0, newArgs, 0, binderState._originalSize);
Array.Copy(args, newArgs, binderState._originalSize);
args = newArgs;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private static void EnsureEventSourceIndexAvailable(int eventSourceIndex)
else if (eventSourceIndex >= CounterGroup.s_counterGroups.Length)
{
WeakReference<CounterGroup>[] newCounterGroups = new WeakReference<CounterGroup>[eventSourceIndex + 1];
Array.Copy(CounterGroup.s_counterGroups, 0, newCounterGroups, 0, CounterGroup.s_counterGroups.Length);
Array.Copy(CounterGroup.s_counterGroups, newCounterGroups, CounterGroup.s_counterGroups.Length);
CounterGroup.s_counterGroups = newCounterGroups;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3502,7 +3502,7 @@ private static void AddEventDescriptor(
if (eventData.Length <= eventAttribute.EventId)
{
EventMetadata[] newValues = new EventMetadata[Math.Max(eventData.Length + 16, eventAttribute.EventId + 1)];
Array.Copy(eventData, 0, newValues, 0, eventData.Length);
Array.Copy(eventData, newValues, eventData.Length);
eventData = newValues;
}

Expand Down Expand Up @@ -3542,7 +3542,7 @@ private static void TrimEventDescriptors(ref EventMetadata[] eventData)
if (eventData.Length - idx > 2) // allow one wasted slot.
{
EventMetadata[] newValues = new EventMetadata[idx + 1];
Array.Copy(eventData, 0, newValues, 0, newValues.Length);
Array.Copy(eventData, newValues, newValues.Length);
eventData = newValues;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public ItemType GetOrAdd(ItemType newItem)

int oldLength = oldItems.Length;
newItems = new ItemType[oldLength + 1];
Array.Copy(oldItems, 0, newItems, 0, lo);
Array.Copy(oldItems, newItems, lo);
newItems[lo] = newItem;
Array.Copy(oldItems, lo, newItems, lo + 1, oldLength - lo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ internal CalendarId[] CalendarIds

// It worked, remember the list
CalendarId[] temp = new CalendarId[count];
Array.Copy(calendars, 0, temp, 0, count);
Array.Copy(calendars, temp, count);

// Want 1st calendar to be default
// Prior to Vista the enumeration didn't have default calendar first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public static int[] ParseCombiningCharacters(string str)
if (resultCount < len)
{
int[] returnArray = new int[resultCount];
Array.Copy(result, 0, returnArray, 0, resultCount);
Array.Copy(result, returnArray, resultCount);
return returnArray;
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ private void ExpandArrays()
object[] newData = new object[newSize];
Type[] newTypes = new Type[newSize];

Array.Copy(_names, 0, newMembers, 0, _count);
Array.Copy(_values, 0, newData, 0, _count);
Array.Copy(_types, 0, newTypes, 0, _count);
Array.Copy(_names, newMembers, _count);
Array.Copy(_values, newData, _count);
Array.Copy(_types, newTypes, _count);

// Assign the new arrays back to the member vars.
_names = newMembers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal static void AddProvider(EncodingProvider provider)
}

EncodingProvider[] providers = new EncodingProvider[s_providers.Length + 1];
Array.Copy(s_providers, 0, providers, 0, s_providers.Length);
Array.Copy(s_providers, providers, s_providers.Length);
providers[^1] = provider;
s_providers = providers;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public int Capacity
{
int newLen = value - m_ChunkOffset;
char[] newArray = GC.AllocateUninitializedArray<char>(newLen);
Array.Copy(m_ChunkChars, 0, newArray, 0, m_ChunkLength);
Array.Copy(m_ChunkChars, newArray, m_ChunkLength);
m_ChunkChars = newArray;
}
}
Expand Down Expand Up @@ -480,7 +480,7 @@ public int Length
// We crossed a chunk boundary when reducing the Length. We must replace this middle-chunk with a new larger chunk,
// to ensure the capacity we want is preserved.
char[] newArray = GC.AllocateUninitializedArray<char>(newLen);
Array.Copy(chunk.m_ChunkChars, 0, newArray, 0, chunk.m_ChunkLength);
Array.Copy(chunk.m_ChunkChars, newArray, chunk.m_ChunkLength);
m_ChunkChars = newArray;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public IAsyncLocalValueMap Set(IAsyncLocal key, object? value, bool treatNullVal
// Create a new map of the same size that has all of the same pairs, with this new key/value pair
// overwriting the old.
var multi = new MultiElementAsyncLocalValueMap(_keyValues.Length);
Array.Copy(_keyValues, 0, multi._keyValues, 0, _keyValues.Length);
Array.Copy(_keyValues, multi._keyValues, _keyValues.Length);
multi._keyValues[i] = new KeyValuePair<IAsyncLocal, object?>(key, value);
return multi;
}
Expand All @@ -377,7 +377,7 @@ public IAsyncLocalValueMap Set(IAsyncLocal key, object? value, bool treatNullVal
// We have enough elements remaining to warrant a multi map. Create a new one and copy all of the
// elements from this one, except the one to be removed.
var multi = new MultiElementAsyncLocalValueMap(_keyValues.Length - 1);
if (i != 0) Array.Copy(_keyValues, 0, multi._keyValues, 0, i);
if (i != 0) Array.Copy(_keyValues, multi._keyValues, i);
if (i != _keyValues.Length - 1) Array.Copy(_keyValues, i + 1, multi._keyValues, i, _keyValues.Length - i - 1);
return multi;
}
Expand All @@ -397,7 +397,7 @@ public IAsyncLocalValueMap Set(IAsyncLocal key, object? value, bool treatNullVal
if (_keyValues.Length < MaxMultiElements)
{
var multi = new MultiElementAsyncLocalValueMap(_keyValues.Length + 1);
Array.Copy(_keyValues, 0, multi._keyValues, 0, _keyValues.Length);
Array.Copy(_keyValues, multi._keyValues, _keyValues.Length);
multi._keyValues[_keyValues.Length] = new KeyValuePair<IAsyncLocal, object?>(key, value);
return multi;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static void Add(WorkStealingQueue queue)
Debug.Assert(Array.IndexOf(oldQueues, queue) == -1);

var newQueues = new WorkStealingQueue[oldQueues.Length + 1];
Array.Copy(oldQueues, 0, newQueues, 0, oldQueues.Length);
Array.Copy(oldQueues, newQueues, oldQueues.Length);
newQueues[^1] = queue;
if (Interlocked.CompareExchange(ref _queues, newQueues, oldQueues) == oldQueues)
{
Expand Down Expand Up @@ -97,11 +97,11 @@ public static void Remove(WorkStealingQueue queue)
}
else if (pos == oldQueues.Length - 1)
{
Array.Copy(oldQueues, 0, newQueues, 0, newQueues.Length);
Array.Copy(oldQueues, newQueues, newQueues.Length);
}
else
{
Array.Copy(oldQueues, 0, newQueues, 0, pos);
Array.Copy(oldQueues, newQueues, pos);
Array.Copy(oldQueues, pos + 1, newQueues, pos, newQueues.Length - pos);
}

Expand Down
2 changes: 1 addition & 1 deletion src/System.Private.CoreLib/src/System/Attribute.CoreCLR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private static Attribute[] InternalParamGetCustomAttributes(ParameterInfo param,

Attribute[] temp = ret;
ret = CreateAttributeArrayHelper(type, temp.Length + count);
Array.Copy(temp, 0, ret, 0, temp.Length);
Array.Copy(temp, ret, temp.Length);

int offset = temp.Length;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal void SetEventHandle(int eventID, IntPtr eventHandle)
}

IntPtr[] newTable = new IntPtr[newSize];
Array.Copy(m_innerTable, 0, newTable, 0, m_innerTable.Length);
Array.Copy(m_innerTable, newTable, m_innerTable.Length);
Volatile.Write(ref m_innerTable, newTable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ internal void InitCustomAttributeBuilder(ConstructorInfo con, object?[] construc
// Cache information used elsewhere.
m_con = con;
m_constructorArgs = new object?[constructorArgs.Length];
Array.Copy(constructorArgs, 0, m_constructorArgs, 0, constructorArgs.Length);
Array.Copy(constructorArgs, m_constructorArgs, constructorArgs.Length);

Type[] paramTypes;
int i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ public override ParameterInfo[] GetParameters()
{
ParameterInfo[] privateParameters = LoadParameters();
ParameterInfo[] parameters = new ParameterInfo[privateParameters.Length];
Array.Copy(privateParameters, 0, parameters, 0, privateParameters.Length);
Array.Copy(privateParameters, parameters, privateParameters.Length);
return parameters;
}

Expand Down
Loading