From c19e3bbc0486256ea9af8941ebfe008681d9862d Mon Sep 17 00:00:00 2001 From: Tarek Mahmoud Sayed Date: Thu, 8 Mar 2018 13:56:43 -0800 Subject: [PATCH] Collapse AsSpan().Slice(...) into .AsSpan(...) (dotnet/corefx#27867) Signed-off-by: dotnet-bot-corefx-mirror --- .../shared/System/Globalization/CompareInfo.cs | 6 +-- .../shared/System/Globalization/DateTimeParse.cs | 26 ++++++------ .../System/Globalization/HijriCalendar.Win32.cs | 2 +- src/mscorlib/shared/System/IO/Path.Windows.cs | 8 ++-- .../shared/System/IO/PathHelper.Windows.cs | 6 +-- src/mscorlib/shared/System/String.Manipulation.cs | 24 +++++------ src/mscorlib/shared/System/Text/StringBuilder.cs | 48 +++++++++++----------- src/mscorlib/shared/System/TimeZoneInfo.Unix.cs | 8 ++-- 8 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/mscorlib/shared/System/Globalization/CompareInfo.cs b/src/mscorlib/shared/System/Globalization/CompareInfo.cs index db0a660..a288f36 100644 --- a/src/mscorlib/shared/System/Globalization/CompareInfo.cs +++ b/src/mscorlib/shared/System/Globalization/CompareInfo.cs @@ -506,8 +506,8 @@ namespace System.Globalization } return CompareString( - string1.AsSpan().Slice(offset1, length1), - string2.AsSpan().Slice(offset2, length2), + string1.AsSpan(offset1, length1), + string2.AsSpan(offset2, length2), options); } @@ -531,7 +531,7 @@ namespace System.Globalization { Debug.Assert(indexA + lengthA <= strA.Length); Debug.Assert(indexB + lengthB <= strB.Length); - return CompareOrdinalIgnoreCase(strA.AsSpan().Slice(indexA, lengthA), strB.AsSpan().Slice(indexB, lengthB)); + return CompareOrdinalIgnoreCase(strA.AsSpan(indexA, lengthA), strB.AsSpan(indexB, lengthB)); } internal static unsafe int CompareOrdinalIgnoreCase(ReadOnlySpan strA, ReadOnlySpan strB) diff --git a/src/mscorlib/shared/System/Globalization/DateTimeParse.cs b/src/mscorlib/shared/System/Globalization/DateTimeParse.cs index bf86e0c..970d176 100644 --- a/src/mscorlib/shared/System/Globalization/DateTimeParse.cs +++ b/src/mscorlib/shared/System/Globalization/DateTimeParse.cs @@ -331,7 +331,7 @@ namespace System // //////////////////////////////////////////////////////////////////////////// - // End NumEnd NumAmPm NumSpace NumDaySep NumTimesep MonthEnd MonthSpace MonthDSep NumDateSuff NumTimeSuff DayOfWeek YearSpace YearDateSep YearEnd TimeZone Era UTCTimeMark + // End NumEnd NumAmPm NumSpace NumDaySep NumTimesep MonthEnd MonthSpace MonthDSep NumDateSuff NumTimeSuff DayOfWeek YearSpace YearDateSep YearEnd TimeZone Era UTCTimeMark private static DS[][] dateParsingStates = { // DS.BEGIN // DS.BEGIN new DS[] { DS.BEGIN, DS.ERROR, DS.TX_N, DS.N, DS.D_Nd, DS.T_Nt, DS.ERROR, DS.D_M, DS.D_M, DS.D_S, DS.T_S, DS.BEGIN, DS.D_Y, DS.D_Y, DS.ERROR, DS.BEGIN, DS.BEGIN, DS.ERROR}, @@ -713,7 +713,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, return false; } - // we have the date and time separators are same and getting a year number, then change the token to YearDateSep as + // we have the date and time separators are same and getting a year number, then change the token to YearDateSep as // we are sure we are not parsing time. dtok.dtt = DTT.YearDateSep; break; @@ -1002,7 +1002,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, return false; } - // we have the date and time separators are same and getting a Month name, then change the token to MonthDatesep as + // we have the date and time separators are same and getting a Month name, then change the token to MonthDatesep as // we are sure we are not parsing time. dtok.dtt = DTT.MonthDatesep; break; @@ -1212,7 +1212,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, // The has was un-paired return false; } - // Valid Hash usage: eat the hash and continue. + // Valid Hash usage: eat the hash and continue. str.GetNext(); return true; } @@ -2591,7 +2591,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, { if (dtok.dtt == DTT.YearEnd || dtok.dtt == DTT.YearSpace || dtok.dtt == DTT.YearDateSep) { - // When time and date separators are same and we are hitting a year number while the first parsed part of the string was recognized + // When time and date separators are same and we are hitting a year number while the first parsed part of the string was recognized // as part of time (and not a date) DS.T_Nt, DS.T_NNt then change the state to be a date so we try to parse it as a date instead if (dps == DS.T_Nt) { @@ -2608,7 +2608,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, { switch (dtok.dtt) { - // we have the case of Serbia have dates in forms 'd.M.yyyy.' so we can expect '.' after the date parts. + // we have the case of Serbia have dates in forms 'd.M.yyyy.' so we can expect '.' after the date parts. // changing the token to end with space instead of Date Separator will avoid failing the parsing. case DTT.YearDateSep: dtok.dtt = atEnd ? DTT.YearEnd : DTT.YearSpace; break; @@ -2734,7 +2734,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, { if ((result.flags & ParseFlags.CaptureOffset) != 0) { - // This is a DateTimeOffset parse, so the offset will actually be captured directly, and + // This is a DateTimeOffset parse, so the offset will actually be captured directly, and // no adjustment is required in most cases return DateTimeOffsetTimeZonePostProcessing(ref str, ref result, styles); } @@ -2810,7 +2810,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, // Apply validation and adjustments specific to DateTimeOffset private static Boolean DateTimeOffsetTimeZonePostProcessing(ref __DTString str, ref DateTimeResult result, DateTimeStyles styles) { - // For DateTimeOffset, default to the Utc or Local offset when an offset was not specified by + // For DateTimeOffset, default to the Utc or Local offset when an offset was not specified by // the input string. if ((result.flags & ParseFlags.TimeZoneUsed) == 0) { @@ -2833,7 +2833,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, Int64 utcTicks = result.parsedDate.Ticks - offsetTicks; // For DateTimeOffset, both the parsed time and the corresponding UTC value must be within the boundaries - // of a DateTime instance. + // of a DateTime instance. if (utcTicks < DateTime.MinTicks || utcTicks > DateTime.MaxTicks) { result.SetFailure(ParseFailureKind.FormatWithOriginalDateTime, nameof(SR.Format_UTCOutOfRange)); @@ -3668,7 +3668,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, } } - // assume the offset is Local + // assume the offset is Local return DateTime.Now; } @@ -4218,7 +4218,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, } // The "r" and "u" formats incorrectly quoted 'GMT' and 'Z', respectively. We cannot - // correct this mistake for DateTime.ParseExact for compatibility reasons, but we can + // correct this mistake for DateTime.ParseExact for compatibility reasons, but we can // fix it for DateTimeOffset.ParseExact as DateTimeOffset has not been publically released // with this issue. if ((result.flags & ParseFlags.CaptureOffset) != 0) @@ -5045,7 +5045,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, { return false; } - if (m_info.CompareOptionIgnoreCase(Value.Slice(thisPosition, segmentLength), target.AsSpan().Slice(targetPosition, segmentLength)) != 0) + if (m_info.CompareOptionIgnoreCase(Value.Slice(thisPosition, segmentLength), target.AsSpan(targetPosition, segmentLength)) != 0) { return false; } @@ -5071,7 +5071,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR, { return false; } - if (m_info.CompareOptionIgnoreCase(Value.Slice(thisPosition, segmentLength), target.AsSpan().Slice(targetPosition, segmentLength)) != 0) + if (m_info.CompareOptionIgnoreCase(Value.Slice(thisPosition, segmentLength), target.AsSpan(targetPosition, segmentLength)) != 0) { return false; } diff --git a/src/mscorlib/shared/System/Globalization/HijriCalendar.Win32.cs b/src/mscorlib/shared/System/Globalization/HijriCalendar.Win32.cs index 365942c..64a73fb 100644 --- a/src/mscorlib/shared/System/Globalization/HijriCalendar.Win32.cs +++ b/src/mscorlib/shared/System/Globalization/HijriCalendar.Win32.cs @@ -69,7 +69,7 @@ namespace System.Globalization { try { - int advance = Int32.Parse(str.AsSpan().Slice(HijriAdvanceRegKeyEntry.Length), provider:CultureInfo.InvariantCulture); + int advance = Int32.Parse(str.AsSpan(HijriAdvanceRegKeyEntry.Length), provider:CultureInfo.InvariantCulture); if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri)) { hijriAdvance = advance; diff --git a/src/mscorlib/shared/System/IO/Path.Windows.cs b/src/mscorlib/shared/System/IO/Path.Windows.cs index 2d4a343..945bba3 100644 --- a/src/mscorlib/shared/System/IO/Path.Windows.cs +++ b/src/mscorlib/shared/System/IO/Path.Windows.cs @@ -83,7 +83,7 @@ namespace System.IO // Path is current drive rooted i.e. starts with \: // "\Foo" and "C:\Bar" => "C:\Foo" // "\Foo" and "\\?\C:\Bar" => "\\?\C:\Foo" - combinedPath = Join(GetPathRoot(basePath.AsSpan()), path.AsSpan().Slice(1)); // Cut the separator to ensure we don't end up with two separators when joining with the root. + combinedPath = Join(GetPathRoot(basePath.AsSpan()), path.AsSpan(1)); // Cut the separator to ensure we don't end up with two separators when joining with the root. } else if (length >= 2 && PathInternal.IsValidDriveChar(path[0]) && path[1] == PathInternal.VolumeSeparatorChar) { @@ -95,7 +95,7 @@ namespace System.IO // Matching root // "C:Foo" and "C:\Bar" => "C:\Bar\Foo" // "C:Foo" and "\\?\C:\Bar" => "\\?\C:\Bar\Foo" - combinedPath = Join(basePath, path.AsSpan().Slice(2)); + combinedPath = Join(basePath, path.AsSpan(2)); } else { @@ -105,8 +105,8 @@ namespace System.IO combinedPath = !PathInternal.IsDevice(basePath) ? path.Insert(2, @"\") : length == 2 - ? JoinInternal(basePath.AsSpan().Slice(0, 4), path, @"\") - : JoinInternal(basePath.AsSpan().Slice(0, 4), path.AsSpan().Slice(0, 2), @"\", path.AsSpan().Slice(2)); + ? JoinInternal(basePath.AsSpan(0, 4), path, @"\") + : JoinInternal(basePath.AsSpan(0, 4), path.AsSpan(0, 2), @"\", path.AsSpan(2)); } } else diff --git a/src/mscorlib/shared/System/IO/PathHelper.Windows.cs b/src/mscorlib/shared/System/IO/PathHelper.Windows.cs index 6faebe8..ebf748f 100644 --- a/src/mscorlib/shared/System/IO/PathHelper.Windows.cs +++ b/src/mscorlib/shared/System/IO/PathHelper.Windows.cs @@ -84,7 +84,7 @@ namespace System.IO buffer.Append(PathInternal.UncExtendedPathPrefix); // Copy Server\Share\... over to the buffer - buffer.Append(content.AsSpan().Slice(PathInternal.UncPrefixLength)); + buffer.Append(content.AsSpan(PathInternal.UncPrefixLength)); // Return the prefix difference return PathInternal.UncExtendedPrefixLength - PathInternal.UncPrefixLength; @@ -198,7 +198,7 @@ namespace System.IO if (foundIndex < inputLength - 1) { // It was a partial find, put the non-existent part of the path back - outputBuilder.Append(inputBuilder.AsSpan().Slice(foundIndex, inputBuilder.Length - foundIndex)); + outputBuilder.Append(inputBuilder.AsSpan(foundIndex, inputBuilder.Length - foundIndex)); } } } @@ -218,7 +218,7 @@ namespace System.IO builderToUse[PathInternal.UncExtendedPrefixLength - PathInternal.UncPrefixLength] = '\\'; // Strip out any added characters at the front of the string - ReadOnlySpan output = builderToUse.AsSpan().Slice(rootDifference); + ReadOnlySpan output = builderToUse.AsSpan(rootDifference); string returnValue = output.EqualsOrdinal(originalPath.AsSpan()) ? originalPath : new string(output); diff --git a/src/mscorlib/shared/System/String.Manipulation.cs b/src/mscorlib/shared/System/String.Manipulation.cs index 76cbfaa..d2aac0d 100644 --- a/src/mscorlib/shared/System/String.Manipulation.cs +++ b/src/mscorlib/shared/System/String.Manipulation.cs @@ -897,7 +897,7 @@ namespace System return result; } - // a remove that just takes a startindex. + // a remove that just takes a startindex. public string Remove(int startIndex) { if (startIndex < 0) @@ -1136,7 +1136,7 @@ namespace System int count = replacementIdx - thisIdx; if (count != 0) { - this.AsSpan().Slice(thisIdx, count).CopyTo(dstSpan.Slice(dstIdx)); + this.AsSpan(thisIdx, count).CopyTo(dstSpan.Slice(dstIdx)); dstIdx += count; } thisIdx = replacementIdx + oldValueLength; @@ -1148,7 +1148,7 @@ namespace System // Copy over the final non-matching portion at the end of the string. Debug.Assert(this.Length - thisIdx == dstSpan.Length - dstIdx); - this.AsSpan().Slice(thisIdx).CopyTo(dstSpan.Slice(dstIdx)); + this.AsSpan(thisIdx).CopyTo(dstSpan.Slice(dstIdx)); return dst; } @@ -1236,7 +1236,7 @@ namespace System return new string[] { this }; } - string[] result = omitEmptyEntries + string[] result = omitEmptyEntries ? SplitOmitEmptyEntries(sepList, default, 1, count) : SplitKeepEmptyEntries(sepList, default, 1, count); @@ -1301,7 +1301,7 @@ namespace System { return SplitInternal(separator, count, options); } - + Span sepListInitialSpan = stackalloc int[StackallocIntBufferSizeLimit]; var sepListBuilder = new ValueListBuilder(sepListInitialSpan); @@ -1311,14 +1311,14 @@ namespace System MakeSeparatorList(separators, ref sepListBuilder, ref lengthListBuilder); ReadOnlySpan sepList = sepListBuilder.AsSpan(); ReadOnlySpan lengthList = lengthListBuilder.AsSpan(); - + // Handle the special case of no replaces. if (sepList.Length == 0) { return new string[] { this }; } - string[] result = omitEmptyEntries + string[] result = omitEmptyEntries ? SplitOmitEmptyEntries(sepList, lengthList, 0, count) : SplitKeepEmptyEntries(sepList, lengthList, 0, count); @@ -1341,7 +1341,7 @@ namespace System return new string[] { this }; } - string[] result = options == StringSplitOptions.RemoveEmptyEntries + string[] result = options == StringSplitOptions.RemoveEmptyEntries ? SplitOmitEmptyEntries(sepList, default, separator.Length, count) : SplitKeepEmptyEntries(sepList, default, separator.Length, count); @@ -1386,15 +1386,15 @@ namespace System } - // This function will not keep the Empty string + // This function will not keep the Empty string private string[] SplitOmitEmptyEntries(ReadOnlySpan sepList, ReadOnlySpan lengthList, int defaultLength, int count) { Debug.Assert(count >= 2); int numReplaces = sepList.Length; - // Allocate array to hold items. This array may not be - // filled completely in this function, we will create a + // Allocate array to hold items. This array may not be + // filled completely in this function, we will create a // new array and copy string references to that new array. int maxItems = (numReplaces < count) ? (numReplaces + 1) : count; string[] splitStrings = new string[maxItems]; @@ -1555,7 +1555,7 @@ namespace System /// /// separator strngs /// for separator indexes - /// for separator length values + /// for separator length values private void MakeSeparatorList(string[] separators, ref ValueListBuilder sepListBuilder, ref ValueListBuilder lengthListBuilder) { Debug.Assert(separators != null && separators.Length > 0, "separators != null && separators.Length > 0"); diff --git a/src/mscorlib/shared/System/Text/StringBuilder.cs b/src/mscorlib/shared/System/Text/StringBuilder.cs index f94cdbb..185e5a4 100644 --- a/src/mscorlib/shared/System/Text/StringBuilder.cs +++ b/src/mscorlib/shared/System/Text/StringBuilder.cs @@ -18,10 +18,10 @@ using System.Collections.Generic; namespace System.Text { // This class represents a mutable string. It is convenient for situations in - // which it is desirable to modify a string, perhaps by removing, replacing, or + // which it is desirable to modify a string, perhaps by removing, replacing, or // inserting characters, without creating a new String subsequent to - // each modification. - // + // each modification. + // // The methods contained within this class do not return a new StringBuilder // object unless specified otherwise. This class may be used in conjunction with the String // class to carry out modifications upon strings. @@ -30,8 +30,8 @@ namespace System.Text public sealed partial class StringBuilder : ISerializable { // A StringBuilder is internally represented as a linked list of blocks each of which holds - // a chunk of the string. It turns out string as a whole can also be represented as just a chunk, - // so that is what we do. + // a chunk of the string. It turns out string as a whole can also be represented as just a chunk, + // so that is what we do. /// /// The character buffer for this chunk. @@ -73,7 +73,7 @@ namespace System.Text // We want to keep chunk arrays out of large object heap (< 85K bytes ~ 40K chars) to be sure. // Making the maximum chunk size big means less allocation code called, but also more waste // in unused characters and slower inserts / replaces (since you do need to slide characters over - // within a buffer). + // within a buffer). internal const int MaxChunkSize = 8000; /// @@ -377,7 +377,7 @@ namespace System.Text int chunkOffset = chunk.m_ChunkOffset; int chunkLength = chunk.m_ChunkLength; - // Check that we will not overrun our boundaries. + // Check that we will not overrun our boundaries. if ((uint)(chunkLength + chunkOffset) <= (uint)result.Length && (uint)chunkLength <= (uint)sourceArray.Length) { fixed (char* sourcePtr = &sourceArray[0]) @@ -691,7 +691,7 @@ namespace System.Text } // We put this fixed in its own helper to avoid the cost of zero-initing `valueChars` in the - // case we don't actually use it. + // case we don't actually use it. private void AppendHelper(string value) { unsafe @@ -921,7 +921,7 @@ namespace System.Text return this; } - // Ensure we don't insert more chars than we can hold, and we don't + // Ensure we don't insert more chars than we can hold, and we don't // have any integer overflow in our new length. long insertingChars = (long)value.Length * count; if (insertingChars > MaxCapacity - this.Length) @@ -1115,7 +1115,7 @@ namespace System.Text { return AppendJoinCore(&separator, 1, values); } - + private unsafe StringBuilder AppendJoinCore(char* separator, int separatorLength, IEnumerable values) { Debug.Assert(separator != null); @@ -1552,7 +1552,7 @@ namespace System.Text if (startPos != pos) { // There was no brace escaping, extract the item format as a single string - itemFormatSpan = format.AsSpan().Slice(startPos, pos - startPos); + itemFormatSpan = format.AsSpan(startPos, pos - startPos); } } else @@ -1749,7 +1749,7 @@ namespace System.Text int indexInChunk = startIndex - chunk.m_ChunkOffset; while (count > 0) { - // Look for a match in the chunk,indexInChunk pointer + // Look for a match in the chunk,indexInChunk pointer if (StartsWith(chunk, indexInChunk, count, oldValue)) { // Push it on the replacements array (with growth), we will do all replacements in a @@ -1775,13 +1775,13 @@ namespace System.Text if (indexInChunk >= chunk.m_ChunkLength || count == 0) // Have we moved out of the current chunk? { - // Replacing mutates the blocks, so we need to convert to a logical index and back afterwards. + // Replacing mutates the blocks, so we need to convert to a logical index and back afterwards. int index = indexInChunk + chunk.m_ChunkOffset; int indexBeforeAdjustment = index; // See if we accumulated any replacements, if so apply them. ReplaceAllInChunk(replacements, replacementsCount, chunk, oldValue.Length, newValue); - // The replacement has affected the logical index. Adjust it. + // The replacement has affected the logical index. Adjust it. index += ((newValue.Length - oldValue.Length) * replacementsCount); replacementsCount = 0; @@ -1874,7 +1874,7 @@ namespace System.Text throw new ArgumentOutOfRangeException(nameof(valueCount), SR.ArgumentOutOfRange_LengthGreaterThanCapacity); } - // This case is so common we want to optimize for it heavily. + // This case is so common we want to optimize for it heavily. int newIndex = valueCount + m_ChunkLength; if (newIndex <= m_ChunkChars.Length) { @@ -1891,7 +1891,7 @@ namespace System.Text m_ChunkLength = m_ChunkChars.Length; } - // Expand the builder to add another chunk. + // Expand the builder to add another chunk. int restLength = valueCount - firstLength; ExpandByABlock(restLength); Debug.Assert(m_ChunkLength == 0, "A new block was not created."); @@ -1948,16 +1948,16 @@ namespace System.Text { fixed (char* valuePtr = value) { - // calculate the total amount of extra space or space needed for all the replacements. + // calculate the total amount of extra space or space needed for all the replacements. int delta = (value.Length - removeCount) * replacementsCount; StringBuilder targetChunk = sourceChunk; // the target as we copy chars down int targetIndexInChunk = replacements[0]; - // Make the room needed for all the new characters if needed. + // Make the room needed for all the new characters if needed. if (delta > 0) MakeRoom(targetChunk.m_ChunkOffset + targetIndexInChunk, delta, out targetChunk, out targetIndexInChunk, true); - // We made certain that characters after the insertion point are not moved, + // We made certain that characters after the insertion point are not moved, int i = 0; for (;;) { @@ -1974,7 +1974,7 @@ namespace System.Text Debug.Assert(gapStart < sourceChunk.m_ChunkChars.Length, "gap starts at end of buffer. Should not happen"); Debug.Assert(gapStart <= gapEnd, "negative gap size"); Debug.Assert(gapEnd <= sourceChunk.m_ChunkLength, "gap too big"); - if (delta != 0) // can skip the sliding of gaps if source an target string are the same size. + if (delta != 0) // can skip the sliding of gaps if source an target string are the same size. { // Copy the gap data between the current replacement and the next replacement fixed (char* sourcePtr = &sourceChunk.m_ChunkChars[gapStart]) @@ -1987,7 +1987,7 @@ namespace System.Text } } - // Remove extra space if necessary. + // Remove extra space if necessary. if (delta < 0) Remove(targetChunk.m_ChunkOffset + targetIndexInChunk, -delta, out targetChunk, out targetIndexInChunk); } @@ -2056,7 +2056,7 @@ namespace System.Text int lengthToCopy = Math.Min(lengthInChunk, count); ThreadSafeCopy(value, chunk.m_ChunkChars, indexInChunk, lengthToCopy); - // Advance the index. + // Advance the index. indexInChunk += lengthToCopy; if (indexInChunk >= chunk.m_ChunkLength) { @@ -2374,7 +2374,7 @@ namespace System.Text int endIndex = startIndex + count; - // Find the chunks for the start and end of the block to delete. + // Find the chunks for the start and end of the block to delete. chunk = this; StringBuilder endChunk = null; int endIndexInChunk = 0; @@ -2425,7 +2425,7 @@ namespace System.Text // SafeCritical: We ensure that `endIndexInChunk + copyCount` is within range of `m_ChunkChars`, and // also ensure that `copyTargetIndexInChunk + copyCount` is within the chunk. - // Remove any characters in the end chunk, by sliding the characters down. + // Remove any characters in the end chunk, by sliding the characters down. if (copyTargetIndexInChunk != endIndexInChunk) // Sometimes no move is necessary { ThreadSafeCopy(endChunk.m_ChunkChars, endIndexInChunk, endChunk.m_ChunkChars, copyTargetIndexInChunk, copyCount); diff --git a/src/mscorlib/shared/System/TimeZoneInfo.Unix.cs b/src/mscorlib/shared/System/TimeZoneInfo.Unix.cs index 410eaf3..2dcaf67 100644 --- a/src/mscorlib/shared/System/TimeZoneInfo.Unix.cs +++ b/src/mscorlib/shared/System/TimeZoneInfo.Unix.cs @@ -398,7 +398,7 @@ namespace System } /// - /// Enumerate files + /// Enumerate files /// private static IEnumerable EnumerateFilesRecursively(string path) { @@ -1198,9 +1198,9 @@ namespace System int secondDotIndex = dateRule.IndexOf('.', firstDotIndex + 1); if (secondDotIndex > 0) { - if (int.TryParse(dateRule.AsSpan().Slice(1, firstDotIndex - 1), out month) && - int.TryParse(dateRule.AsSpan().Slice(firstDotIndex + 1, secondDotIndex - firstDotIndex - 1), out week) && - int.TryParse(dateRule.AsSpan().Slice(secondDotIndex + 1), out int day)) + if (int.TryParse(dateRule.AsSpan(1, firstDotIndex - 1), out month) && + int.TryParse(dateRule.AsSpan(firstDotIndex + 1, secondDotIndex - firstDotIndex - 1), out week) && + int.TryParse(dateRule.AsSpan(secondDotIndex + 1), out int day)) { dayOfWeek = (DayOfWeek)day; return true; -- 2.7.4