Replace Array.Copy(src, dst, int) calls with Array.Copy(src, 0, dst, … · dotnet/coreclr@6911791 (original) (raw)

This repository was archived by the owner on Jan 23, 2023. It is now read-only.

File tree

11 files changed

lines changed

11 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -1852,7 +1852,7 @@ internal CalendarId[] CalendarIds
1852 1852
1853 1853 // It worked, remember the list
1854 1854 CalendarId[] temp = new CalendarId[count];
1855 -Array.Copy(calendars, temp, count);
1855 +Array.Copy(calendars, 0, temp, 0, count);
1856 1856
1857 1857 // Want 1st calendar to be default
1858 1858 // Prior to Vista the enumeration didn't have default calendar first
Original file line number Diff line number Diff line change
@@ -341,7 +341,7 @@ public static int[] ParseCombiningCharacters(string str)
341 341 if (resultCount < len)
342 342 {
343 343 int[] returnArray = new int[resultCount];
344 -Array.Copy(result, returnArray, resultCount);
344 +Array.Copy(result, 0, returnArray, 0, resultCount);
345 345 return (returnArray);
346 346 }
347 347 return (result);
Original file line number Diff line number Diff line change
@@ -134,9 +134,9 @@ private void ExpandArrays()
134 134 object[] newData = new object[newSize];
135 135 Type[] newTypes = new Type[newSize];
136 136
137 -Array.Copy(_names, newMembers, _count);
138 -Array.Copy(_values, newData, _count);
139 -Array.Copy(_types, newTypes, _count);
137 +Array.Copy(_names, 0, newMembers, 0, _count);
138 +Array.Copy(_values, 0, newData, 0, _count);
139 +Array.Copy(_types, 0, newTypes, 0, _count);
140 140
141 141 // Assign the new arrays back to the member vars.
142 142 _names = newMembers;
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ internal static void AddProvider(EncodingProvider provider)
60 60 }
61 61
62 62 EncodingProvider[] providers = new EncodingProvider[s_providers.Length + 1];
63 -Array.Copy(s_providers, providers, s_providers.Length);
63 +Array.Copy(s_providers, 0, providers, 0, s_providers.Length);
64 64 providers[providers.Length - 1] = provider;
65 65 s_providers = providers;
66 66 }
Original file line number Diff line number Diff line change
@@ -310,7 +310,7 @@ private static Attribute[] InternalParamGetCustomAttributes(ParameterInfo param,
310 310
311 311 Attribute[] temp = ret;
312 312 ret = CreateAttributeArrayHelper(type, temp.Length + count);
313 -Array.Copy(temp, ret, temp.Length);
313 +Array.Copy(temp, 0, ret, 0, temp.Length);
314 314
315 315 int offset = temp.Length;
316 316
Original file line number Diff line number Diff line change
@@ -365,13 +365,13 @@ internal void Init(string name,
365 365 if (publicKey != null)
366 366 {
367 367 _publicKey = new byte[publicKey.Length];
368 -Array.Copy(publicKey, _publicKey, publicKey.Length);
368 +Array.Copy(publicKey, 0, _publicKey, 0, publicKey.Length);
369 369 }
370 370
371 371 if (publicKeyToken != null)
372 372 {
373 373 _publicKeyToken = new byte[publicKeyToken.Length];
374 -Array.Copy(publicKeyToken, _publicKeyToken, publicKeyToken.Length);
374 +Array.Copy(publicKeyToken, 0, _publicKeyToken, 0, publicKeyToken.Length);
375 375 }
376 376
377 377 if (version != null)
Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@ public override ParameterInfo[] GetParameters()
260 260 return parameters;
261 261
262 262 ParameterInfo[] ret = new ParameterInfo[parameters.Length];
263 -Array.Copy(parameters, ret, parameters.Length);
263 +Array.Copy(parameters, 0, ret, 0, parameters.Length);
264 264 return ret;
265 265 }
266 266
Original file line number Diff line number Diff line change
@@ -365,7 +365,7 @@ public override ParameterInfo[] GetParameters()
365 365
366 366 ParameterInfo[] ret = new ParameterInfo[m_parameters.Length];
367 367
368 -Array.Copy(m_parameters, ret, m_parameters.Length);
368 +Array.Copy(m_parameters, 0, ret, 0, m_parameters.Length);
369 369
370 370 return ret;
371 371 }
Original file line number Diff line number Diff line change
@@ -305,7 +305,7 @@ public override ParameterInfo[] GetIndexParameters()
305 305
306 306 ParameterInfo[] ret = new ParameterInfo[numParams];
307 307
308 -Array.Copy(indexParams, ret, numParams);
308 +Array.Copy(indexParams, 0, ret, 0, numParams);
309 309
310 310 return ret;
311 311 }
Original file line number Diff line number Diff line change
@@ -3416,7 +3416,7 @@ public override string[] GetEnumNames()
3416 3416 // Make a copy since we can't hand out the same array since users can modify them
3417 3417 string[] retVal = new string[ret.Length];
3418 3418
3419 -Array.Copy(ret, retVal, ret.Length);
3419 +Array.Copy(ret, 0, retVal, 0, ret.Length);
3420 3420
3421 3421 return retVal;
3422 3422 }
Original file line number Diff line number Diff line change
@@ -1505,7 +1505,7 @@ public static T[] GetObjectsForNativeVariants(IntPtr aSrcNativeVariant, int c
1505 1505 if (objects != null)
1506 1506 {
1507 1507 result = new T[objects.Length];
1508 -Array.Copy(objects, result, objects.Length);
1508 +Array.Copy(objects, 0, result, 0, objects.Length);
1509 1509 }
1510 1510
1511 1511 return result;