From 1662c96ff3fc0e58b9b77ccf2022ab528ffff358 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Mon, 19 Aug 2019 21:25:08 -0400 Subject: [PATCH] Fix StyleCop warning SA1002 (semicolon spacing) Commit migrated from https://github.com/dotnet/coreclr/commit/ef4940d1332b929b9d42e7a9390cace58b01b931 --- .../WindowsRuntime/WindowsRuntimeMarshal.cs | 4 ++-- .../Buffers/Text/Utf8Parser/Utf8Parser.Guid.cs | 2 +- .../src/System/Decimal.DecCalc.cs | 10 ++++----- .../src/System/Diagnostics/Tracing/EventSource.cs | 8 ++++---- .../Diagnostics/Tracing/TraceLogging/NameInfo.cs | 2 +- .../src/System/Globalization/CalendarData.cs | 2 +- .../src/System/Globalization/CultureData.cs | 4 ++-- .../System/Globalization/Normalization.Windows.cs | 2 +- .../System.Private.CoreLib/src/System/Guid.cs | 4 ++-- .../src/System/ParseNumbers.cs | 2 +- .../src/System/Text/StringBuilder.cs | 16 +++++++-------- .../src/System/Text/UTF32Encoding.cs | 14 ++++++------- .../src/System/Text/UnicodeEncoding.cs | 24 +++++++++++----------- .../src/System/Threading/ManualResetEventSlim.cs | 4 ++-- .../src/System/Threading/ReaderWriterLockSlim.cs | 6 +++--- 15 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs index 9a5d0ec..5d272e3 100644 --- a/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs +++ b/src/coreclr/src/System.Private.CoreLib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs @@ -849,7 +849,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime internal void AcquireReaderLock(int millisecondsTimeout) { EnterMyLock(); - for (;;) + while (true) { // We can enter a read lock if there are only read-locks have been given out // and a writer is not trying to get in. @@ -875,7 +875,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime internal void AcquireWriterLock(int millisecondsTimeout) { EnterMyLock(); - for (;;) + while (true) { if (owners == 0) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Guid.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Guid.cs index 3c58791..cd2a821 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Guid.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Parser/Utf8Parser.Guid.cs @@ -210,7 +210,7 @@ namespace System.Buffers.Text return false; } - source = source.Slice(5);// justConsumed + 1 for delimiter + source = source.Slice(5); // justConsumed + 1 for delimiter if (!TryParseUInt64X(source, out ulong i5, out justConsumed)) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs b/src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs index af28aa8..2d2d973 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs @@ -477,7 +477,7 @@ namespace System // prod1 = bufDen.Low64; - for (;;) + while (true) { quo--; num += prod1; @@ -593,7 +593,7 @@ PosRem: uint sticky = 0; uint quotient, remainder = 0; - for (;;) + while (true) { sticky |= remainder; // record remainder as sticky bit @@ -1945,7 +1945,7 @@ ReturnZero: bufQuo.U2 = d1.High; uint remainder = Div96By32(ref bufQuo, den); - for (;;) + while (true) { if (remainder == 0) { @@ -2042,7 +2042,7 @@ ReturnZero: bufQuo.U1 = Div96By64(ref *(Buf12*)&bufRem.U1, divisor); bufQuo.U0 = Div96By64(ref *(Buf12*)&bufRem, divisor); - for (;;) + while (true) { if (bufRem.Low64 == 0) { @@ -2106,7 +2106,7 @@ ReturnZero: bufQuo.Low64 = Div128By96(ref bufRem, ref bufDivisor); bufQuo.U2 = 0; - for (;;) + while (true) { if ((bufRem.Low64 | bufRem.U2) == 0) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs index 8e8cd51..8dba3a8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs @@ -3907,7 +3907,7 @@ namespace System.Diagnostics.Tracing private bool m_completelyInited; // The EventSource constructor has returned without exception. private Exception? m_constructionException; // If there was an exception construction, this is it private byte m_outOfBandMessageCount; // The number of out of band messages sent (we throttle them - private EventCommandEventArgs? m_deferredCommands;// If we get commands before we are fully we store them here and run the when we are fully inited. + private EventCommandEventArgs? m_deferredCommands; // If we get commands before we are fully we store them here and run the when we are fully inited. private string[]? m_traits; // Used to implement GetTraits @@ -4090,7 +4090,7 @@ namespace System.Diagnostics.Tracing { // Find 'this' from the s_Listeners linked list. EventListener prev = s_Listeners; - for (;;) + while (true) { EventListener? cur = prev.m_Next; if (cur == null) @@ -4360,7 +4360,7 @@ namespace System.Diagnostics.Tracing { // Remove 'listenerToRemove' from the eventSource.m_Dispatchers linked list. EventDispatcher? prev = eventSource.m_Dispatchers; - for (;;) + while (true) { EventDispatcher? cur = prev.m_Next; if (cur == null) @@ -4432,7 +4432,7 @@ namespace System.Diagnostics.Tracing foreach (EventListener listener in allListeners.Keys) { dispatcher = eventSource.m_Dispatchers; - for (;;) + while (true) { Debug.Assert(dispatcher != null, "Listener is not on all eventSources."); if (dispatcher.m_Listener == listener) diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/NameInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/NameInfo.cs index 1685e6a..17bf2eb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/NameInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/NameInfo.cs @@ -27,7 +27,7 @@ namespace System.Diagnostics.Tracing /// internal static void ReserveEventIDsBelow(int eventId) { - for (;;) + while (true) { int snapshot = lastIdentity; int newIdentity = (lastIdentity & ~0xFFFFFF) + eventId; diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.cs index aae2c00..39c164a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.cs @@ -80,7 +80,7 @@ namespace System.Globalization invariant.saEraNames = new string[] { "A.D." }; // Era names invariant.saAbbrevEraNames = new string[] { "AD" }; // Abbreviated Era names invariant.saAbbrevEnglishEraNames = new string[] { "AD" }; // Abbreviated era names in English - invariant.saDayNames = new string[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };// day names + invariant.saDayNames = new string[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; // day names invariant.saAbbrevDayNames = new string[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; // abbreviated day names invariant.saSuperShortDayNames = new string[] { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" }; // The super short day names invariant.saMonthNames = new string[] { "January", "February", "March", "April", "May", "June", diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs index 87cc7ee..69dbd88 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs @@ -63,7 +63,7 @@ namespace System.Globalization private string? _sNativeLanguage; // Native name of this language private string? _sAbbrevLang; // abbreviated language name (Windows Language Name) ex: ENU private string? _sConsoleFallbackName; // The culture name for the console fallback UI culture - private int _iInputLanguageHandle=undef;// input language handle + private int _iInputLanguageHandle=undef; // input language handle // Region private string? _sRegionName; // (RegionInfo) @@ -72,7 +72,7 @@ namespace System.Globalization private string? _sNativeCountry; // native country name private string? _sISO3166CountryName; // ISO 3166 (RegionInfo), ie: US private string? _sISO3166CountryName2; // 3 char ISO 3166 country name 2 2(RegionInfo) ex: USA (ISO) - private int _iGeoId = undef; // GeoId + private int _iGeoId = undef; // GeoId // Numbers private string? _sPositiveSign; // (user can override) positive sign diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Windows.cs index b04a672..e96789d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/Normalization.Windows.cs @@ -105,7 +105,7 @@ namespace System.Globalization // Someplace to stick our buffer char[] cBuffer; - for (;;) + while (true) { // (re)allocation buffer and normalize string cBuffer = new char[iLength]; diff --git a/src/libraries/System.Private.CoreLib/src/System/Guid.cs b/src/libraries/System.Private.CoreLib/src/System/Guid.cs index f0f8a94..97de756 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Guid.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Guid.cs @@ -664,7 +664,7 @@ namespace System // Skip past leading 0s. int i = 0; - for (; i < guidString.Length && guidString[i] == '0'; i++); + for (; i < guidString.Length && guidString[i] == '0'; i++) ; int processedDigits = 0; ReadOnlySpan charToHexLookup = Number.CharToHexLookup; @@ -1108,7 +1108,7 @@ namespace System { fixed (char* guidChars = &MemoryMarshal.GetReference(destination)) { - char * p = guidChars; + char* p = guidChars; if (braces != 0) *p++ = (char)braces; diff --git a/src/libraries/System.Private.CoreLib/src/System/ParseNumbers.cs b/src/libraries/System.Private.CoreLib/src/System/ParseNumbers.cs index 71bff4d..9504672 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ParseNumbers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ParseNumbers.cs @@ -507,7 +507,7 @@ namespace System private static void EatWhiteSpace(ReadOnlySpan s, ref int i) { int localIndex = i; - for (; localIndex < s.Length && char.IsWhiteSpace(s[localIndex]); localIndex++); + for (; localIndex < s.Length && char.IsWhiteSpace(s[localIndex]); localIndex++) ; i = localIndex; } diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs b/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs index 414aa86..a89b711 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs @@ -271,7 +271,7 @@ namespace System.Text StringBuilder currentBlock = this; int maxCapacity = this.m_MaxCapacity; - for (;;) + while (true) { // All blocks have the same max capacity. Debug.Assert(currentBlock.m_MaxCapacity == maxCapacity); @@ -510,7 +510,7 @@ namespace System.Text get { StringBuilder? chunk = this; - for (;;) + while (true) { int indexInBlock = index - chunk.m_ChunkOffset; if (indexInBlock >= 0) @@ -531,7 +531,7 @@ namespace System.Text set { StringBuilder? chunk = this; - for (;;) + while (true) { int indexInBlock = index - chunk.m_ChunkOffset; if (indexInBlock >= 0) @@ -1849,7 +1849,7 @@ namespace System.Text int thisChunkIndex = thisChunk.m_ChunkLength; StringBuilder? sbChunk = sb; int sbChunkIndex = sbChunk.m_ChunkLength; - for (;;) + while (true) { --thisChunkIndex; --sbChunkIndex; @@ -2048,7 +2048,7 @@ namespace System.Text int endIndex = startIndex + count; StringBuilder chunk = this; - for (;;) + while (true) { int endIndexInChunk = endIndex - chunk.m_ChunkOffset; int startIndexInChunk = startIndex - chunk.m_ChunkOffset; @@ -2192,7 +2192,7 @@ namespace System.Text // We made certain that characters after the insertion point are not moved, int i = 0; - for (;;) + while (true) { // Copy in the new string for the ith replacement ReplaceInPlaceAtChunk(ref targetChunk!, ref targetIndexInChunk, valuePtr, value.Length); @@ -2285,7 +2285,7 @@ namespace System.Text { if (count != 0) { - for (;;) + while (true) { Debug.Assert(chunk != null, "chunk should not be null at this point"); int lengthInChunk = chunk.m_ChunkLength - indexInChunk; @@ -2622,7 +2622,7 @@ namespace System.Text chunk = this; StringBuilder? endChunk = null; int endIndexInChunk = 0; - for (;;) + while (true) { if (endIndex - chunk.m_ChunkOffset >= 0) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/UTF32Encoding.cs b/src/libraries/System.Private.CoreLib/src/System/Text/UTF32Encoding.cs index 1dcdd2a..0687830a 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/UTF32Encoding.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/UTF32Encoding.cs @@ -940,8 +940,8 @@ namespace System.Text bytes -= 4; // get back to where we were iChar = 0; // Remembering nothing fallbackBuffer.InternalReset(); - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output - break; // Stop here, didn't throw + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output + break; // Stop here, didn't throw } // Ignore the illegal character @@ -963,8 +963,8 @@ namespace System.Text "[UTF32Encoding.GetChars]Expected to have consumed bytes or throw (surrogate)"); bytes -= 4; // get back to where we were iChar = 0; // Remembering nothing - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output - break; // Stop here, didn't throw + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output + break; // Stop here, didn't throw } *(chars++) = GetHighSurrogate(iChar); @@ -980,8 +980,8 @@ namespace System.Text "[UTF32Encoding.GetChars]Expected to have consumed bytes or throw (normal char)"); bytes -= 4; // get back to where we were iChar = 0; // Remembering nothing - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output - break; // Stop here, didn't throw + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output + break; // Stop here, didn't throw } // Add the rest of the surrogate or our normal character @@ -1022,7 +1022,7 @@ namespace System.Text { // Couldn't fallback. fallbackBuffer.InternalReset(); - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output // Stop here, didn't throw, backed up, so still nothing in buffer } else diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/UnicodeEncoding.cs b/src/libraries/System.Private.CoreLib/src/System/Text/UnicodeEncoding.cs index e899e2d..ed7a0d9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/UnicodeEncoding.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/UnicodeEncoding.cs @@ -1509,8 +1509,8 @@ namespace System.Text "[UnicodeEncoding.GetChars]Expected bytes to have advanced or no output (bad surrogate)"); bytes -= 2; // didn't use these 2 bytes fallbackBuffer.InternalReset(); - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output - break; // couldn't fallback but didn't throw + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output + break; // couldn't fallback but didn't throw } } @@ -1561,8 +1561,8 @@ namespace System.Text "[UnicodeEncoding.GetChars]Expected bytes to have advanced or no output (lonely surrogate)"); bytes -= 2; // didn't use these 2 bytes fallbackBuffer.InternalReset(); - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output - break; // couldn't fallback but didn't throw + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output + break; // couldn't fallback but didn't throw } // Didn't throw, ignore this one (we already did its fallback) @@ -1577,9 +1577,9 @@ namespace System.Text Debug.Assert(bytes >= byteStart + 2 || chars == charStart, "[UnicodeEncoding.GetChars]Expected bytes to have advanced or no output (surrogate pair)"); bytes -= 2; // didn't use these 2 bytes - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output // Leave lastChar for next call to Convert() - break; // couldn't fallback but didn't throw + break; // couldn't fallback but didn't throw } *chars++ = lastChar; @@ -1623,8 +1623,8 @@ namespace System.Text "[UnicodeEncoding.GetChars]Expected bytes to have advanced or no output (no low surrogate)"); bytes -= 2; // didn't use these 2 bytes fallbackBuffer.InternalReset(); - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output - break; // couldn't fallback but didn't throw + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output + break; // couldn't fallback but didn't throw } // Not left over now, clear previous high surrogate and continue to add current char @@ -1639,8 +1639,8 @@ namespace System.Text Debug.Assert(bytes >= byteStart + 2 || chars == charStart, "[UnicodeEncoding.GetChars]Expected bytes to have advanced or no output (normal)"); bytes -= 2; // didn't use these bytes - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output - break; // couldn't fallback but didn't throw + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output + break; // couldn't fallback but didn't throw } // add it @@ -1690,7 +1690,7 @@ namespace System.Text if (lastByte >= 0) bytes--; // had an extra last byte hanging around fallbackBuffer.InternalReset(); - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output // We'll remember these in our decoder though bytes += 2; if (lastByte >= 0) @@ -1725,7 +1725,7 @@ namespace System.Text // odd byte couldn't fall back bytes--; // didn't use this byte fallbackBuffer.InternalReset(); - ThrowCharsOverflow(decoder, chars == charStart);// Might throw, if no chars output + ThrowCharsOverflow(decoder, chars == charStart); // Might throw, if no chars output // didn't throw, but we'll remember it in the decoder bytes++; goto End; diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs index cbc4210..65caf17 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ManualResetEventSlim.cs @@ -45,11 +45,11 @@ namespace System.Threading private volatile int m_combinedState; //ie a uint. Used for the state items listed below. //1-bit for signalled state - private const int SignalledState_BitMask = unchecked((int)0x80000000);//1000 0000 0000 0000 0000 0000 0000 0000 + private const int SignalledState_BitMask = unchecked((int)0x80000000); //1000 0000 0000 0000 0000 0000 0000 0000 private const int SignalledState_ShiftCount = 31; //1-bit for disposed state - private const int Dispose_BitMask = unchecked((int)0x40000000);//0100 0000 0000 0000 0000 0000 0000 0000 + private const int Dispose_BitMask = unchecked((int)0x40000000); //0100 0000 0000 0000 0000 0000 0000 0000 //11-bits for m_spinCount private const int SpinCountState_BitMask = unchecked((int)0x3FF80000); //0011 1111 1111 1000 0000 0000 0000 0000 diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/ReaderWriterLockSlim.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/ReaderWriterLockSlim.cs index e19e8ea..a11963f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/ReaderWriterLockSlim.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/ReaderWriterLockSlim.cs @@ -369,7 +369,7 @@ namespace System.Threading bool retVal = true; int spinCount = 0; - for (; ;) + while (true) { // We can enter a read lock if there are only read-locks have been given out // and a writer is not trying to get in. @@ -521,7 +521,7 @@ namespace System.Threading bool retVal = true; int spinCount = 0; - for (; ;) + while (true) { if (IsWriterAcquired()) { @@ -716,7 +716,7 @@ namespace System.Threading bool retVal = true; int spinCount = 0; - for (; ;) + while (true) { //Once an upgrade lock is taken, it's like having a reader lock held //until upgrade or downgrade operations are performed. -- 2.7.4