1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-09 17:44:48 +09:00

Enable IDE0054 (Use compound assignment) (#70564)

* Enable IDE0054 (Use compound assignment)

* Update src/libraries/System.Data.Common/src/System/Data/Common/StringStorage.cs

Co-authored-by: Tanner Gooding <tagoo@outlook.com>

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
This commit is contained in:
Stephen Toub 2022-06-17 05:26:03 -04:00 committed by GitHub
parent 30379b718d
commit a796755292
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
162 changed files with 344 additions and 346 deletions

View file

@ -1458,7 +1458,7 @@ dotnet_diagnostic.IDE0052.severity = suggestion
dotnet_diagnostic.IDE0053.severity = silent
# IDE0054: Use compound assignment
dotnet_diagnostic.IDE0054.severity = suggestion
dotnet_diagnostic.IDE0054.severity = warning
# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = suggestion

View file

@ -217,7 +217,7 @@ namespace System.Runtime
int thunkIndex = (int)(((nuint)(nint)nextAvailableThunkPtr) - ((nuint)(nint)nextAvailableThunkPtr & ~Constants.PageSizeMask));
Debug.Assert((thunkIndex % Constants.ThunkDataSize) == 0);
thunkIndex = thunkIndex / Constants.ThunkDataSize;
thunkIndex /= Constants.ThunkDataSize;
IntPtr thunkAddress = InternalCalls.RhpGetThunkStubsBlockAddress(nextAvailableThunkPtr) + thunkIndex * Constants.ThunkCodeSize;

View file

@ -897,7 +897,7 @@ namespace System
throw new OverflowException();
if (length > MaxLength)
maxArrayDimensionLengthOverflow = true;
totalLength = totalLength * (ulong)length;
totalLength *= (ulong)length;
if (totalLength > int.MaxValue)
throw new OutOfMemoryException(); // "Array dimensions exceeded supported range."
}

View file

@ -90,7 +90,7 @@ namespace System.Reflection.Runtime.Assemblies.NativeFormat
{
string ns = namespaceHandle.ToNamespaceName(reader);
if (ns.Length != 0)
ns = ns + ".";
ns += ".";
ns = ns.ToLowerInvariant();
NamespaceDefinition namespaceDefinition = namespaceHandle.GetNamespaceDefinition(reader);

View file

@ -540,7 +540,7 @@ namespace System.Runtime.CompilerServices
for (; i >= 0; i--)
{
chars[i] = GetHexChar((uint)(u % 16));
u = u / 16;
u /= 16;
if ((i == 0) || (!zeroPrepad && (u == 0)))
break;

View file

@ -249,7 +249,7 @@ namespace Internal.Reflection.Execution.PayForPlayExperience
{
genericParameterOffsets.Add(s.Length);
if (genericArgCount > 0)
s = s + ",";
s += ",";
}
s += "]";
}
@ -283,7 +283,7 @@ namespace Internal.Reflection.Execution.PayForPlayExperience
// Similarly, if we found too few, add them at the end.
while (genericTypeArguments.Length > genericParameterOffsets.Count)
{
genericTypeDefinitionString = genericTypeDefinitionString + ",";
genericTypeDefinitionString += ",";
genericParameterOffsets.Add(genericTypeDefinitionString.Length);
}

View file

@ -941,7 +941,7 @@ namespace Internal.Runtime.TypeLoader
}
else
{
seriesSize = seriesSize - size;
seriesSize -= size;
*ptr-- = (void*)seriesOffset;
*ptr-- = (void*)seriesSize;
}

View file

@ -209,7 +209,7 @@ namespace Internal.Runtime.TypeLoader
fieldData->FieldName = fieldName;
// Special flag (lowest bit set) in the handle value to indicate it was dynamically allocated
runtimeFieldHandleValue = runtimeFieldHandleValue + 1;
runtimeFieldHandleValue++;
runtimeFieldHandle = *(RuntimeFieldHandle*)&runtimeFieldHandleValue;
_runtimeFieldHandles.Add(key, runtimeFieldHandle);
@ -232,7 +232,7 @@ namespace Internal.Runtime.TypeLoader
// Special flag in the handle value to indicate it was dynamically allocated
Debug.Assert((runtimeFieldHandleValue.ToInt64() & 0x1) == 0x1);
runtimeFieldHandleValue = runtimeFieldHandleValue - 1;
runtimeFieldHandleValue--;
DynamicFieldHandleInfo* fieldData = (DynamicFieldHandleInfo*)runtimeFieldHandleValue.ToPointer();
declaringTypeHandle = *(RuntimeTypeHandle*)&(fieldData->DeclaringType);
@ -317,7 +317,7 @@ namespace Internal.Runtime.TypeLoader
}
// Special flag in the handle value to indicate it was dynamically allocated, and doesn't point into the InvokeMap blob
runtimeMethodHandleValue = runtimeMethodHandleValue + 1;
runtimeMethodHandleValue++;
runtimeMethodHandle = * (RuntimeMethodHandle*)&runtimeMethodHandleValue;
_runtimeMethodHandles.Add(key, runtimeMethodHandle);
@ -344,7 +344,7 @@ namespace Internal.Runtime.TypeLoader
Debug.Assert((runtimeMethodHandleValue.ToInt64() & 0x1) == 0x1);
// Special flag in the handle value to indicate it was dynamically allocated, and doesn't point into the InvokeMap blob
runtimeMethodHandleValue = runtimeMethodHandleValue - 1;
runtimeMethodHandleValue--;
DynamicMethodHandleInfo* methodData = (DynamicMethodHandleInfo*)runtimeMethodHandleValue.ToPointer();
declaringTypeHandle = *(RuntimeTypeHandle*)&(methodData->DeclaringType);

View file

@ -417,7 +417,7 @@ namespace Internal.Runtime.TypeLoader
// what we have now is the base address of the non-gc statics of the type
// what we need is the cctor context, which is just before that
ptr = ptr - sizeof(System.Runtime.CompilerServices.StaticClassConstructionContext);
ptr -= sizeof(System.Runtime.CompilerServices.StaticClassConstructionContext);
return (IntPtr)ptr;
}

View file

@ -121,7 +121,7 @@ namespace Internal.Runtime
while ((alignment & 1) == 0)
{
alignmentLog2++;
alignment = alignment >> 1;
alignment >>= 1;
}
Debug.Assert(alignment == 1);

View file

@ -233,7 +233,7 @@ namespace Internal.TypeSystem
previousInterval.EndSentinel = newInterval.EndSentinel;
fieldLayoutInterval[newIntervalLocation - 1] = previousInterval;
newIntervalLocation = newIntervalLocation - 1;
newIntervalLocation--;
}
else
{

View file

@ -125,7 +125,7 @@ namespace Internal.NativeFormat
while (arg != 0)
{
sb.Append((char)('0' + (arg % 10)));
arg = arg / 10;
arg /= 10;
}
// Reverse the string

View file

@ -139,7 +139,7 @@ namespace Microsoft.NET.HostModel.Bundle
public long Write(BinaryWriter writer)
{
BundleID = BundleID ?? GenerateDeterministicId();
BundleID ??= GenerateDeterministicId();
long startOffset = writer.BaseStream.Position;

View file

@ -111,7 +111,7 @@ internal static partial class Interop
if (protocols != SslProtocols.None &&
CipherSuitesPolicyPal.WantsTls13(protocols))
{
protocols = protocols & (~SslProtocols.Tls13);
protocols &= ~SslProtocols.Tls13;
}
}
else if (CipherSuitesPolicyPal.WantsTls13(protocols) &&

View file

@ -41,7 +41,7 @@ internal static partial class SafeLsaMemoryHandleExtensions
if (domainList.Domains != IntPtr.Zero)
{
Interop.LSA_TRUST_INFORMATION* pTrustInformation = (Interop.LSA_TRUST_INFORMATION*)domainList.Domains;
pTrustInformation = pTrustInformation + domainList.Entries;
pTrustInformation += domainList.Entries;
long bufferSize = (byte*)pTrustInformation - pRdl;
System.Diagnostics.Debug.Assert(bufferSize > 0, "bufferSize > 0");

View file

@ -141,7 +141,7 @@ namespace System.IO
}
}
startIndex = startIndex + key.Length;
startIndex += key.Length;
}
}

View file

@ -73,7 +73,7 @@ namespace System.Net.Http.HPack
throw new HPackDecodingException(SR.net_http_hpack_bad_integer);
}
_i = _i + ((b & 0x7f) << _m);
_i += ((b & 0x7f) << _m);
// If the addition overflowed, the result will be negative.
if (_i < 0)
@ -81,7 +81,7 @@ namespace System.Net.Http.HPack
throw new HPackDecodingException(SR.net_http_hpack_bad_integer);
}
_m = _m + 7;
_m += 7;
if ((b & 128) == 0)
{

View file

@ -50,7 +50,7 @@ namespace System.Net.Http.HPack
return false;
}
value = value - ((1 << numBits) - 1);
value -= ((1 << numBits) - 1);
int i = 1;
while (value >= 128)
@ -63,7 +63,7 @@ namespace System.Net.Http.HPack
return false;
}
value = value / 128;
value /= 128;
}
destination[i++] = (byte)value;

View file

@ -245,11 +245,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
switch (GetConvKind(info.ptRaw1, bos.pt1))
{
default:
grflt = grflt | LiftFlags.Convert1;
grflt |= LiftFlags.Convert1;
break;
case ConvKind.Implicit:
case ConvKind.Identity:
grflt = grflt | LiftFlags.Lift1;
grflt |= LiftFlags.Lift1;
break;
}
break;
@ -272,11 +272,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
switch (GetConvKind(info.ptRaw1, bos.pt1))
{
default:
grflt = grflt | LiftFlags.Convert1;
grflt |= LiftFlags.Convert1;
break;
case ConvKind.Implicit:
case ConvKind.Identity:
grflt = grflt | LiftFlags.Lift1;
grflt |= LiftFlags.Lift1;
break;
}
break;
@ -330,11 +330,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
switch (GetConvKind(info.ptRaw2, bos.pt2))
{
default:
grflt = grflt | LiftFlags.Convert2;
grflt |= LiftFlags.Convert2;
break;
case ConvKind.Implicit:
case ConvKind.Identity:
grflt = grflt | LiftFlags.Lift2;
grflt |= LiftFlags.Lift2;
break;
}
break;
@ -357,11 +357,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
switch (GetConvKind(info.ptRaw2, bos.pt2))
{
default:
grflt = grflt | LiftFlags.Convert2;
grflt |= LiftFlags.Convert2;
break;
case ConvKind.Implicit:
case ConvKind.Identity:
grflt = grflt | LiftFlags.Lift2;
grflt |= LiftFlags.Lift2;
break;
}
break;
@ -750,7 +750,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
if (info.type2 is NullableType)
{
pgrflt = pgrflt | LiftFlags.Lift2;
pgrflt |= LiftFlags.Lift2;
ptypeSig2 = TypeManager.GetNullable(info.typeRaw2);
}
else
@ -785,7 +785,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
if (info.type1 is NullableType)
{
pgrflt = pgrflt | LiftFlags.Lift1;
pgrflt |= LiftFlags.Lift1;
ptypeSig1 = TypeManager.GetNullable(info.typeRaw1);
}
else
@ -809,7 +809,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
if (info.type1 != info.typeRaw1)
{
Debug.Assert(info.type1 is NullableType);
grflt = grflt | LiftFlags.Lift1;
grflt |= LiftFlags.Lift1;
typeSig1 = TypeManager.GetNullable(info.typeRaw1);
}
else
@ -820,7 +820,7 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
if (info.type2 != info.typeRaw2)
{
Debug.Assert(info.type2 is NullableType);
grflt = grflt | LiftFlags.Lift2;
grflt |= LiftFlags.Lift2;
typeSig2 = TypeManager.GetNullable(info.typeRaw2);
}
else
@ -1482,11 +1482,11 @@ namespace Microsoft.CSharp.RuntimeBinder.Semantics
switch (GetConvKind(ptRaw, uos.pt))
{
default:
grflt = grflt | LiftFlags.Convert1;
grflt |= LiftFlags.Convert1;
break;
case ConvKind.Implicit:
case ConvKind.Identity:
grflt = grflt | LiftFlags.Lift1;
grflt |= LiftFlags.Lift1;
break;
}

View file

@ -213,7 +213,7 @@ namespace Microsoft.CSharp.RuntimeBinder
else if (member is EventInfo e)
{
// Store events until after all fields
(events = events ?? new List<EventInfo>()).Add(e);
(events ??= new List<EventInfo>()).Add(e);
}
} while (memberEn.MoveNext());

View file

@ -37,7 +37,7 @@ namespace System.Numerics
const uint c3 = 0x_0F0F0F0Fu;
const uint c4 = 0x_01010101u;
value = value - ((value >> 1) & c1);
value -= (value >> 1) & c1;
value = (value & c2) + ((value >> 2) & c2);
value = (((value + (value >> 4)) & c3) * c4) >> 24;

View file

@ -64,7 +64,7 @@ namespace Microsoft.Extensions.DependencyInjection
}
catch (Exception e)
{
exceptions = exceptions ?? new List<Exception>();
exceptions ??= new List<Exception>();
exceptions.Add(e);
}
}

View file

@ -58,7 +58,7 @@ namespace Microsoft.Extensions.FileSystemGlobbing.Internal.PatternContexts
}
// directory matches segment, advance position in pattern
frame.SegmentIndex = frame.SegmentIndex + 1;
frame.SegmentIndex++;
}
PushDataFrame(frame);

View file

@ -36,7 +36,7 @@ namespace Microsoft.Extensions.Options
/// </summary>
public virtual TOptions Get(string? name)
{
name = name ?? Options.DefaultName;
name ??= Options.DefaultName;
if (!_cache.TryGetValue(name, out TOptions? options))
{

View file

@ -63,7 +63,7 @@ namespace Microsoft.Extensions.Options
private void InvokeChanged(string? name)
{
name = name ?? Options.DefaultName;
name ??= Options.DefaultName;
_cache.TryRemove(name);
TOptions options = Get(name);
if (_onChange != null)

View file

@ -319,7 +319,7 @@ namespace Microsoft.XmlSerializer.Generator
var allMappings = mappings.ToArray();
bool gac = assembly.GlobalAssemblyCache;
outputDirectory = outputDirectory ?? (gac ? Environment.CurrentDirectory : Path.GetDirectoryName(assembly.Location));
outputDirectory ??= (gac ? Environment.CurrentDirectory : Path.GetDirectoryName(assembly.Location));
if (!Directory.Exists(outputDirectory))
{

View file

@ -749,8 +749,8 @@ namespace System.Collections.Concurrent
// the bit-masking, because we only do this if tail == int.MaxValue, meaning that all
// bits are set, so all of the bits we're keeping will also be set. Thus it's impossible
// for the head to end up > than the tail, since you can't set any more bits than all of them.
_headIndex = _headIndex & _mask;
_tailIndex = tail = tail & _mask;
_headIndex &= _mask;
_tailIndex = tail &= _mask;
Debug.Assert(_headIndex - _tailIndex <= 0);
Interlocked.Exchange(ref _currentOp, (int)Operation.Add); // ensure subsequent reads aren't reordered before this

View file

@ -770,7 +770,7 @@ namespace System.Collections.Immutable
Requires.Range(startIndex >= 0 && startIndex < this.Count, nameof(startIndex));
Requires.Range(count >= 0 && startIndex + count <= this.Count, nameof(count));
equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
equalityComparer ??= EqualityComparer<T>.Default;
if (equalityComparer == EqualityComparer<T>.Default)
{
return Array.IndexOf(_elements, item, startIndex, count);
@ -867,7 +867,7 @@ namespace System.Collections.Immutable
Requires.Range(startIndex >= 0 && startIndex < this.Count, nameof(startIndex));
Requires.Range(count >= 0 && startIndex - count + 1 >= 0, nameof(count));
equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
equalityComparer ??= EqualityComparer<T>.Default;
if (equalityComparer == EqualityComparer<T>.Default)
{
return Array.LastIndexOf(_elements, item, startIndex, count);

View file

@ -166,7 +166,7 @@ namespace System.Collections.Immutable
Requires.Range(startIndex >= 0 && startIndex < self.Length, nameof(startIndex));
Requires.Range(count >= 0 && startIndex + count <= self.Length, nameof(count));
equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
equalityComparer ??= EqualityComparer<T>.Default;
if (equalityComparer == EqualityComparer<T>.Default)
{
return Array.IndexOf(self.array!, item, startIndex, count);
@ -251,7 +251,7 @@ namespace System.Collections.Immutable
Requires.Range(startIndex >= 0 && startIndex < self.Length, nameof(startIndex));
Requires.Range(count >= 0 && startIndex - count + 1 >= 0, nameof(count));
equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
equalityComparer ??= EqualityComparer<T>.Default;
if (equalityComparer == EqualityComparer<T>.Default)
{
return Array.LastIndexOf(self.array!, item, startIndex, count);

View file

@ -636,7 +636,7 @@ namespace System.Collections.Immutable
{
Requires.Range(index >= 0, nameof(index));
Requires.Range(count >= 0, nameof(count));
comparer = comparer ?? Comparer<T>.Default;
comparer ??= Comparer<T>.Default;
if (this.IsEmpty || count <= 0)
{
@ -748,7 +748,7 @@ namespace System.Collections.Immutable
Requires.Range(count <= this.Count, nameof(count));
Requires.Range(index + count <= this.Count, nameof(count));
equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
equalityComparer ??= EqualityComparer<T>.Default;
using (var enumerator = new Enumerator(this, startIndex: index, count: count))
{
while (enumerator.MoveNext())
@ -789,7 +789,7 @@ namespace System.Collections.Immutable
Requires.Range(count >= 0 && count <= this.Count, nameof(count));
Requires.Argument(index - count + 1 >= 0);
equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
equalityComparer ??= EqualityComparer<T>.Default;
using (var enumerator = new Enumerator(this, startIndex: index, count: count, reversed: true))
{
while (enumerator.MoveNext())

View file

@ -32,7 +32,7 @@ namespace System.ComponentModel.Composition
{
get
{
return typeIdentityCache = typeIdentityCache ?? new Dictionary<Type, string>();
return typeIdentityCache ??= new Dictionary<Type, string>();
}
}

View file

@ -32,7 +32,7 @@ namespace System.ComponentModel.Composition.Hosting
Action<ComposablePartCatalogChangeEventArgs>? onChanged,
Action<ComposablePartCatalogChangeEventArgs>? onChanging)
{
catalogs = catalogs ?? Enumerable.Empty<ComposablePartCatalog>();
catalogs ??= Enumerable.Empty<ComposablePartCatalog>();
_catalogs = new List<ComposablePartCatalog>(catalogs);
_onChanged = onChanged;
_onChanging = onChanging;

View file

@ -28,7 +28,7 @@ namespace System.ComponentModel.Composition.ReflectionModel
{
get
{
return _castSingleValueCache = _castSingleValueCache ?? new Dictionary<Type, Func<Export, object>?>();
return _castSingleValueCache ??= new Dictionary<Type, Func<Export, object>?>();
}
}

View file

@ -90,9 +90,9 @@ namespace System.Composition.Hosting.Core
{
var hc = _contractType.GetHashCode();
if (_contractName != null)
hc = hc ^ _contractName.GetHashCode();
hc ^= _contractName.GetHashCode();
if (_metadataConstraints != null)
hc = hc ^ ConstraintHashCode(_metadataConstraints);
hc ^= ConstraintHashCode(_metadataConstraints);
return hc;
}

View file

@ -47,7 +47,7 @@ namespace System.Composition.TypedParts
var ima = attr as ImportManyAttribute;
if (ima != null)
{
importMetadata = importMetadata ?? new Dictionary<string, object>();
importMetadata ??= new Dictionary<string, object>();
importMetadata.Add(ImportManyImportMetadataConstraintName, true);
importedContract = new CompositionContract(memberType, ima.ContractName);
explicitImportsApplied++;
@ -57,7 +57,7 @@ namespace System.Composition.TypedParts
var imca = attr as ImportMetadataConstraintAttribute;
if (imca != null)
{
importMetadata = importMetadata ?? new Dictionary<string, object>();
importMetadata ??= new Dictionary<string, object>();
importMetadata.Add(imca.Name, imca.Value);
}
}
@ -72,7 +72,7 @@ namespace System.Composition.TypedParts
.GetRuntimeProperties()
.Where(p => p.GetMethod.IsPublic && p.DeclaringType == attrType && p.CanRead))
{
importMetadata = importMetadata ?? new Dictionary<string, object>();
importMetadata ??= new Dictionary<string, object>();
importMetadata.Add(prop.Name, prop.GetValue(attr, null));
}
}

View file

@ -33,7 +33,7 @@ namespace System.Composition.TypedParts.Discovery
foreach (var export in DiscoverExports(type))
{
part = part ?? new DiscoveredPart(type, _attributeContext, _activationFeatures);
part ??= new DiscoveredPart(type, _attributeContext, _activationFeatures);
part.AddDiscoveredExport(export);
}

View file

@ -66,7 +66,7 @@ namespace System.Configuration
sb.Append(',');
}
if (sb.Length > 0) sb.Length = sb.Length - 1;
if (sb.Length > 0) sb.Length--;
return sb.Length == 0 ? null : sb.ToString();
}

View file

@ -88,7 +88,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -131,7 +131,7 @@ namespace System.Data.Common
{
// help the user out in the case where there's less data than requested
if ((ndataIndex + length) > cbytes)
cbytes = cbytes - ndataIndex;
cbytes -= ndataIndex;
else
cbytes = length;
}
@ -205,7 +205,7 @@ namespace System.Data.Common
// help the user out in the case where there's less data than requested
if ((ndataIndex + length) > cchars)
{
cchars = cchars - ndataIndex;
cchars -= ndataIndex;
}
else
{

View file

@ -91,7 +91,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -88,7 +88,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -91,7 +91,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -91,7 +91,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -91,7 +91,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -88,7 +88,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -90,7 +90,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -90,7 +90,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -90,7 +90,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -90,7 +90,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -90,7 +90,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -90,7 +90,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -90,7 +90,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -90,7 +90,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -38,7 +38,7 @@ namespace System.Data.Common
}
if (min >= 0)
{
for (i = i + 1; i < recordNos.Length; i++)
for (i++; i < recordNos.Length; i++)
{
if (IsNull(recordNos[i]))
continue;
@ -63,7 +63,7 @@ namespace System.Data.Common
}
if (max >= 0)
{
for (i = i + 1; i < recordNos.Length; i++)
for (i++; i < recordNos.Length; i++)
{
if (Compare(max, recordNos[i]) < 0)
{

View file

@ -88,7 +88,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -33,7 +33,7 @@ namespace System.Data.Common
}
if (min >= 0)
{
for (i = i + 1; i < recordNos.Length; i++)
for (i++; i < recordNos.Length; i++)
{
if (IsNull(recordNos[i]))
continue;
@ -57,7 +57,7 @@ namespace System.Data.Common
}
if (max >= 0)
{
for (i = i + 1; i < recordNos.Length; i++)
for (i++; i < recordNos.Length; i++)
{
if (Compare(max, recordNos[i]) < 0)
{

View file

@ -91,7 +91,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -91,7 +91,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -91,7 +91,7 @@ namespace System.Data.Common
if ((prec < 1e-15) || (var < 0))
var = 0;
else
var = var / (count * (count - 1));
var /= (count * (count - 1));
if (kind == AggregateType.StDev)
{

View file

@ -2225,7 +2225,7 @@ namespace System.Data.SqlTypes
ulQuotientCur = (uint)(dwlAccum / dwlDivisor);
rguiData[iData - 1] = ulQuotientCur;
//Remainder to be carried to the next lower significant byte.
dwlAccum = dwlAccum % dwlDivisor;
dwlAccum %= dwlDivisor;
// While current part of quotient still 0, reduce length
if (fAllZero && (ulQuotientCur == 0))

View file

@ -150,7 +150,7 @@ namespace System.Data.SqlTypes
long ret = _value / (s_lTickBase / 10);
bool fPositive = (ret >= 0);
long remainder = ret % 10;
ret = ret / 10;
ret /= 10;
if (remainder >= 5)
{

View file

@ -1493,7 +1493,7 @@ namespace System.Data
int i = 0;
colName = typeName + "_Text";
while (table.Columns[colName] != null)
colName = colName + i++;
colName += i++;
}
else
{
@ -2003,7 +2003,7 @@ namespace System.Data
colName = table.TableName + "_Text";
while (table.Columns[colName] != null)
{
colName = colName + i++;
colName += i++;
}
}
else
@ -2115,7 +2115,7 @@ namespace System.Data
colName = table.TableName + "_Text";
while (table.Columns[colName] != null)
{
colName = colName + i++;
colName += i++;
}
}
else

View file

@ -1093,7 +1093,7 @@ namespace System.Data
_fileName = Path.GetFileNameWithoutExtension(fs.Name);
_fileExt = Path.GetExtension(fs.Name);
if (!string.IsNullOrEmpty(_filePath))
_filePath = _filePath + "\\";
_filePath += "\\";
}
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]

View file

@ -844,7 +844,7 @@ namespace System.Data.Odbc
int flags;
flags = GetInfoInt32Unhandled((ODBC32.SQL_INFO)sqlconvert);
flags = flags & (int)sqlcvt;
flags &= (int)sqlcvt;
ProviderInfo.TestedSQLTypes |= (int)sqlcvt;
ProviderInfo.SupportedSQLTypes |= flags;

View file

@ -636,19 +636,19 @@ namespace System.Data.Odbc
Common.SupportedJoinOperators supportedJoinOperators = Common.SupportedJoinOperators.None;
if ((int32Value & (int)ODBC32.SQL_OJ_CAPABILITIES.LEFT) != 0)
{
supportedJoinOperators = supportedJoinOperators | Common.SupportedJoinOperators.LeftOuter;
supportedJoinOperators |= Common.SupportedJoinOperators.LeftOuter;
}
if ((int32Value & (int)ODBC32.SQL_OJ_CAPABILITIES.RIGHT) != 0)
{
supportedJoinOperators = supportedJoinOperators | Common.SupportedJoinOperators.RightOuter;
supportedJoinOperators |= Common.SupportedJoinOperators.RightOuter;
}
if ((int32Value & (int)ODBC32.SQL_OJ_CAPABILITIES.FULL) != 0)
{
supportedJoinOperators = supportedJoinOperators | Common.SupportedJoinOperators.FullOuter;
supportedJoinOperators |= Common.SupportedJoinOperators.FullOuter;
}
if ((int32Value & (int)ODBC32.SQL_OJ_CAPABILITIES.INNER) != 0)
{
supportedJoinOperators = supportedJoinOperators | Common.SupportedJoinOperators.Inner;
supportedJoinOperators |= Common.SupportedJoinOperators.Inner;
}
dataSourceInformation[DbMetaDataColumnNames.SupportedJoinOperators] = supportedJoinOperators;

View file

@ -218,7 +218,7 @@ namespace System.Diagnostics.Eventing.Reader
// fact that we've already read some events in our buffer that the user
// hasn't seen yet.
//
offset = offset - (_eventCount - _currentIndex);
offset -= (_eventCount - _currentIndex);
SeekReset();

View file

@ -100,7 +100,7 @@ namespace System.Diagnostics.Eventing.Reader
// theKeywords = theKeywords - mask;
}
// Modify the mask to check next bit.
mask = mask >> 1;
mask >>= 1;
}
return list;

View file

@ -193,7 +193,7 @@ namespace System.Diagnostics
// make sure the start address is 8 byte aligned
int startAddressMod8 = (int)(_baseAddress + oldOffset) & 0x7;
alignmentAdjustment = (8 - startAddressMod8) & 0x7;
currentTotalSize = currentTotalSize + alignmentAdjustment;
currentTotalSize += alignmentAdjustment;
int newOffset = oldOffset + currentTotalSize;
@ -670,7 +670,7 @@ namespace System.Diagnostics
{
fileMappingSize = GetFileMappingSizeFromConfig();
if (data.UseUniqueSharedMemory)
fileMappingSize = fileMappingSize >> 2; // if we have a custom filemapping, only make it 25% as large.
fileMappingSize >>= 2; // if we have a custom filemapping, only make it 25% as large.
}
// now read the counter names

View file

@ -72,7 +72,7 @@ namespace System.Diagnostics
private List<Process> GetChildProcesses(Process[]? processes = null)
{
bool internallyInitializedProcesses = processes == null;
processes = processes ?? GetProcesses();
processes ??= GetProcesses();
List<Process> childProcesses = new List<Process>();

View file

@ -192,7 +192,7 @@ namespace System.DirectoryServices.AccountManagement
}
else
{
_lowRange = _lowRange + pvc.Count;
_lowRange += pvc.Count;
GlobalDebug.WriteLineIf(GlobalDebug.Info,
"RangeRetriever",

View file

@ -669,7 +669,7 @@ namespace System.DirectoryServices.AccountManagement
if (!isSAM && de.Properties["msDS-User-Account-Control-Computed"].Count > 0)
{
Debug.Assert(de.Properties["msDS-User-Account-Control-Computed"].Count == 1);
uacValue = uacValue | (int)de.Properties["msDS-User-Account-Control-Computed"][0];
uacValue |= (int)de.Properties["msDS-User-Account-Control-Computed"][0];
}
}
else

View file

@ -53,7 +53,7 @@ namespace System.DirectoryServices.ActiveDirectory
if (links == null)
throw new ArgumentNullException(nameof(links));
for (int i = 0; i < links.Length; i = i + 1)
for (int i = 0; i < links.Length; i++)
this.Add(links[i]);
}

View file

@ -224,7 +224,7 @@ namespace System.DirectoryServices.ActiveDirectory
}
// now add the domainName
recordName = recordName + domainName;
recordName += domainName;
// set the BYPASS CACHE option is specified
if (((long)dcFlags & (long)LocatorOptions.ForceRediscovery) != 0)

View file

@ -143,8 +143,8 @@ namespace System.Drawing
// We need to copy from the back forward to prevent overwrite if source and
// destination lists are the same, so we need to flip the source/dest indices
// to point at the end of the spans to be copied.
sourceIndex = sourceIndex + length;
destinationIndex = destinationIndex + length;
sourceIndex += length;
destinationIndex += length;
for (; length > 0; length--)
{
destinationList.InnerList[--destinationIndex] = sourceList.InnerList[--sourceIndex];

View file

@ -219,7 +219,7 @@ namespace System.IO.Compression
public void SkipToByteBoundary()
{
_bitBuffer >>= (_bitsInBuffer % 8);
_bitsInBuffer = _bitsInBuffer - (_bitsInBuffer % 8);
_bitsInBuffer -= (_bitsInBuffer % 8);
}
}
}

View file

@ -1280,7 +1280,7 @@ namespace System.IO.Ports
internal void SetDcbFlag(int whichFlag, int setting)
{
uint mask;
setting = setting << whichFlag;
setting <<= whichFlag;
Debug.Assert(whichFlag >= Interop.Kernel32.DCBFlags.FBINARY && whichFlag <= Interop.Kernel32.DCBFlags.FDUMMY2, "SetDcbFlag needs to fit into enum!");
@ -1705,7 +1705,7 @@ namespace System.IO.Ports
return;
}
errors = errors & ErrorEvents;
errors &= ErrorEvents;
// TODO: what about CE_BREAK? Is this the same as EV_BREAK? EV_BREAK happens as one of the pin events,
// but CE_BREAK is returned from ClreaCommError.
// TODO: what about other error conditions not covered by the enum? Should those produce some other error?

View file

@ -241,7 +241,7 @@ namespace System.Linq.Expressions.Interpreter
return null;
}
//return the last one that is smaller
i = i - 1;
i--;
}
return debugInfos[i];

View file

@ -703,7 +703,7 @@ namespace System.Linq.Parallel
{
if ((mutables._chunkCounter++ & chunksPerChunkSize) == chunksPerChunkSize)
{
mutables._nextChunkMaxSize = mutables._nextChunkMaxSize * 2;
mutables._nextChunkMaxSize *= 2;
if (mutables._nextChunkMaxSize > chunkBuffer.Length)
{
mutables._nextChunkMaxSize = chunkBuffer.Length;

View file

@ -62,7 +62,7 @@ namespace System.Linq.Parallel
IOrderedEnumerable<TInputOutput> IOrderedEnumerable<TInputOutput>.CreateOrderedEnumerable<TKey2>(
Func<TInputOutput, TKey2> key2Selector, IComparer<TKey2>? key2Comparer, bool descending)
{
key2Comparer = key2Comparer ?? Util.GetDefaultComparer<TKey2>();
key2Comparer ??= Util.GetDefaultComparer<TKey2>();
if (descending)
{

View file

@ -5139,7 +5139,7 @@ namespace System.Linq
ArgumentNullException.ThrowIfNull(keySelector);
// comparer may be null, in which case we use the default comparer.
comparer = comparer ?? EqualityComparer<TKey>.Default;
comparer ??= EqualityComparer<TKey>.Default;
ParallelQuery<IGrouping<TKey, TSource>> groupings = source.GroupBy(keySelector, comparer);
@ -5226,7 +5226,7 @@ namespace System.Linq
ArgumentNullException.ThrowIfNull(elementSelector);
// comparer may be null, in which case we use the default comparer.
comparer = comparer ?? EqualityComparer<TKey>.Default;
comparer ??= EqualityComparer<TKey>.Default;
ParallelQuery<IGrouping<TKey, TElement>> groupings = source.GroupBy(keySelector, elementSelector, comparer);

View file

@ -260,12 +260,12 @@ namespace System.Management
string dmtfDateTime = date.Year.ToString(frmInt32).PadLeft(4, '0');
dmtfDateTime = (dmtfDateTime + date.Month.ToString(frmInt32).PadLeft(2, '0'));
dmtfDateTime = (dmtfDateTime + date.Day.ToString(frmInt32).PadLeft(2, '0'));
dmtfDateTime = (dmtfDateTime + date.Hour.ToString(frmInt32).PadLeft(2, '0'));
dmtfDateTime = (dmtfDateTime + date.Minute.ToString(frmInt32).PadLeft(2, '0'));
dmtfDateTime = (dmtfDateTime + date.Second.ToString(frmInt32).PadLeft(2, '0'));
dmtfDateTime = (dmtfDateTime + ".");
dmtfDateTime += date.Month.ToString(frmInt32).PadLeft(2, '0');
dmtfDateTime += date.Day.ToString(frmInt32).PadLeft(2, '0');
dmtfDateTime += date.Hour.ToString(frmInt32).PadLeft(2, '0');
dmtfDateTime += date.Minute.ToString(frmInt32).PadLeft(2, '0');
dmtfDateTime += date.Second.ToString(frmInt32).PadLeft(2, '0');
dmtfDateTime += ".";
// Construct a DateTime with the precision to Second as same as the passed DateTime and so get
// the ticks difference so that the microseconds can be calculated
@ -278,9 +278,9 @@ namespace System.Management
{
strMicrosec = strMicrosec.Substring(0, 6);
}
dmtfDateTime = dmtfDateTime + strMicrosec.PadLeft(6, '0');
dmtfDateTime += strMicrosec.PadLeft(6, '0');
// adding the UTC offset
dmtfDateTime = dmtfDateTime + UtcString;
dmtfDateTime += UtcString;
return dmtfDateTime;
}
@ -370,7 +370,7 @@ namespace System.Management
// Get a timepan for the additional ticks obtained for the microsecond part of DMTF time interval
// and then add it to the original timespan
TimeSpan tsTemp = System.TimeSpan.FromTicks(ticks);
timespan = timespan + tsTemp;
timespan += tsTemp;
return timespan;
}
@ -417,10 +417,10 @@ namespace System.Management
throw new System.ArgumentOutOfRangeException(nameof(timespan));
}
dmtftimespan = (dmtftimespan + timespan.Hours.ToString(frmInt32).PadLeft(2, '0'));
dmtftimespan = (dmtftimespan + timespan.Minutes.ToString(frmInt32).PadLeft(2, '0'));
dmtftimespan = (dmtftimespan + timespan.Seconds.ToString(frmInt32).PadLeft(2, '0'));
dmtftimespan = (dmtftimespan + ".");
dmtftimespan += timespan.Hours.ToString(frmInt32).PadLeft(2, '0');
dmtftimespan += timespan.Minutes.ToString(frmInt32).PadLeft(2, '0');
dmtftimespan += timespan.Seconds.ToString(frmInt32).PadLeft(2, '0');
dmtftimespan += ".";
// Construct a DateTime with the precision to Second as same as the passed DateTime and so get
// the ticks difference so that the microseconds can be calculated
@ -433,9 +433,9 @@ namespace System.Management
{
strMicrosec = strMicrosec.Substring(0, 6);
}
dmtftimespan = dmtftimespan + strMicrosec.PadLeft(6, '0');
dmtftimespan += strMicrosec.PadLeft(6, '0');
dmtftimespan = dmtftimespan + ":000";
dmtftimespan += ":000";
return dmtftimespan;
}

View file

@ -271,7 +271,7 @@ namespace System.Management
// this is because in the case of "root", the path parser cannot tell whether
// this is a namespace name or a class name
if (string.Equals(path, "root", StringComparison.OrdinalIgnoreCase))
flags = flags | (uint)tag_WBEM_PATH_CREATE_FLAG.WBEMPATH_TREAT_SINGLE_IDENT_AS_NS;
flags |= (uint)tag_WBEM_PATH_CREATE_FLAG.WBEMPATH_TREAT_SINGLE_IDENT_AS_NS;
int status = wbemPath.SetText_(flags, path);

View file

@ -932,7 +932,7 @@ namespace System.Management
s = s + selectedProperties[i] + ((i == (count - 1)) ? " " : ",");
}
else
s = s + "* ";
s += "* ";
//From clause
s = s + "from " + className;
@ -2993,7 +2993,7 @@ namespace System.Management
if ((null != groupByPropertyList) && (0 < groupByPropertyList.Count))
{
int count = groupByPropertyList.Count;
s = s + " by ";
s += " by ";
for (int i = 0; i < count; i++)
s = s + groupByPropertyList[i] + (i == (count - 1) ? "" : ",");

View file

@ -461,7 +461,7 @@ namespace System.Management
if ((null != propertyValue) && propertyValue.GetType().IsArray)
{
isArray = true;
wmiCimType = (wmiCimType | (int)tag_CIMTYPE_ENUMERATION.CIM_FLAG_ARRAY);
wmiCimType |= (int)tag_CIMTYPE_ENUMERATION.CIM_FLAG_ARRAY;
}
object wmiValue = PropertyData.MapValueToWmiValue(propertyValue, propertyType, isArray);
@ -500,7 +500,7 @@ namespace System.Management
int wmiCimType = (int)propertyType;
if (isArray)
wmiCimType = (wmiCimType | (int)tag_CIMTYPE_ENUMERATION.CIM_FLAG_ARRAY);
wmiCimType |= (int)tag_CIMTYPE_ENUMERATION.CIM_FLAG_ARRAY;
object dummyObj = System.DBNull.Value;

View file

@ -464,12 +464,12 @@ namespace System.Management
//Build the flavors bitmask and call the internal Add that takes a bitmask
int qualFlavor = 0;
if (isAmended) qualFlavor = (qualFlavor | (int)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_AMENDED);
if (propagatesToInstance) qualFlavor = (qualFlavor | (int)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE);
if (propagatesToSubclass) qualFlavor = (qualFlavor | (int)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS);
if (isAmended) qualFlavor |= (int)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_AMENDED;
if (propagatesToInstance) qualFlavor |= (int)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE;
if (propagatesToSubclass) qualFlavor |= (int)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS;
// Note we use the NOT condition here since WBEM_FLAVOR_OVERRIDABLE == 0
if (!isOverridable) qualFlavor = (qualFlavor | (int)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_NOT_OVERRIDABLE);
if (!isOverridable) qualFlavor |= (int)tag_WBEM_FLAVOR_TYPE.WBEM_FLAVOR_NOT_OVERRIDABLE;
//Try to add the qualifier to the WMI object
int status = GetTypeQualifierSet().Put_(qualifierName, ref qualifierValue, qualFlavor);

View file

@ -563,7 +563,7 @@ namespace System.Management
{
if (bStart == true)
{
OriginalNamespace = OriginalNamespace + arrString[i];
OriginalNamespace += arrString[i];
}
else
if (arrString[i] == '\\')
@ -816,7 +816,7 @@ namespace System.Management
}
catch (OverflowException)
{
strToAdd = strToAdd + "_";
strToAdd += "_";
k = 0;
}
strTemp = inString + strToAdd + k.ToString((IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(int)));
@ -972,7 +972,7 @@ namespace System.Management
if (isStatic)
{
cmp.Attributes = cmp.Attributes | MemberAttributes.Static;
cmp.Attributes |= MemberAttributes.Static;
}
caa = new CodeAttributeArgument();
@ -1951,7 +1951,7 @@ namespace System.Management
// Now shift 1 more bit so that we can put it for the
// next element in the enum
bitValue = bitValue << 1;
bitValue <<= 1;
}
if (bZeroFieldInEnum == false)
@ -1984,11 +1984,11 @@ namespace System.Management
cmf.Name = "NULL_ENUM_VALUE";
if (BitValues.Count > 30)
{
maxBitValue = maxBitValue + 1;
maxBitValue++;
}
else
{
maxBitValue = maxBitValue << 1;
maxBitValue <<= 1;
}
cmf.InitExpression = new CodePrimitiveExpression((int)(maxBitValue));
EnumObj.Members.Add(cmf);
@ -2048,7 +2048,7 @@ namespace System.Management
string strPath = OriginalNamespace + ":" + OriginalClassName;
if (bSingletonClass == true)
{
strPath = strPath + "=@";
strPath += "=@";
cmm.Statements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(strPath)));
}
else
@ -3701,7 +3701,7 @@ namespace System.Management
cf.Attributes = MemberAttributes.Private | MemberAttributes.Final;
if (isStatic == true)
{
cf.Attributes = cf.Attributes | MemberAttributes.Static;
cf.Attributes |= MemberAttributes.Static;
}
cf.Type = new CodeTypeReference(MemberType);
if (initExpression != null && isStatic == true)
@ -5012,7 +5012,7 @@ namespace System.Management
int Len = bitMap.Length;
for (int i = 2; i < Len; i++)
{
strTemp = strTemp + arrString[i];
strTemp += arrString[i];
}
ret = System.Convert.ToInt32(strTemp, (IFormatProvider)CultureInfo.InvariantCulture.GetFormat(typeof(int)));
}

View file

@ -87,7 +87,7 @@ namespace System.Net.Http.Headers
if (!string.IsNullOrEmpty(_parameter))
{
result = result ^ _parameter.GetHashCode();
result ^= _parameter.GetHashCode();
}
return result;
@ -148,7 +148,7 @@ namespace System.Net.Http.Headers
int current = startIndex + schemeLength;
int whitespaceLength = HttpRuleParser.GetWhitespaceLength(input, current);
current = current + whitespaceLength;
current += whitespaceLength;
if ((current == input.Length) || (input[current] == ','))
{
@ -206,7 +206,7 @@ namespace System.Net.Http.Headers
// We have a quote but an invalid quoted-string.
return false;
}
current = current + quotedStringLength;
current += quotedStringLength;
parameterEndIndex = current - 1; // -1 because 'current' points to the char after the final '"'
}
else
@ -223,7 +223,7 @@ namespace System.Net.Http.Headers
}
else
{
current = current + whitespaceLength;
current += whitespaceLength;
}
}
}
@ -256,8 +256,8 @@ namespace System.Net.Http.Headers
return false;
}
current = current + tokenLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += tokenLength;
current += HttpRuleParser.GetWhitespaceLength(input, current);
// If we reached the end of the string or the token is followed by anything but '=', then the parsed
// token is another scheme name. The string representing parameters ends before the token (e.g.
@ -268,7 +268,7 @@ namespace System.Net.Http.Headers
}
current++; // skip '=' delimiter
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
int valueLength = NameValueHeaderValue.GetValueLength(input, current);
// After '<name>=' we expect a valid <value> (either token or quoted string)
@ -279,9 +279,9 @@ namespace System.Net.Http.Headers
// Update parameter end index, since we just parsed a valid <name>=<value> pair that is part of the
// parameters string.
current = current + valueLength;
current += valueLength;
parameterEndIndex = current - 1; // -1 because 'current' already points to the char after <value>
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
parseEndIndex = current; // this essentially points to parameterEndIndex + whitespace + next char
} while ((current < input.Length) && (input[current] == ','));

View file

@ -66,7 +66,7 @@ namespace System.Net.Http.Headers
return false;
}
current = current + length;
current += length;
current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(value, current, SupportsMultipleValues,
out separatorFound);

View file

@ -338,7 +338,7 @@ namespace System.Net.Http.Headers
{
foreach (var noCacheHeader in _noCacheHeaders)
{
result = result ^ StringComparer.OrdinalIgnoreCase.GetHashCode(noCacheHeader);
result ^= StringComparer.OrdinalIgnoreCase.GetHashCode(noCacheHeader);
}
}
@ -346,7 +346,7 @@ namespace System.Net.Http.Headers
{
foreach (var privateHeader in _privateHeaders)
{
result = result ^ StringComparer.OrdinalIgnoreCase.GetHashCode(privateHeader);
result ^= StringComparer.OrdinalIgnoreCase.GetHashCode(privateHeader);
}
}
@ -354,7 +354,7 @@ namespace System.Net.Http.Headers
{
foreach (var extension in _extensions)
{
result = result ^ extension.GetHashCode();
result ^= extension.GetHashCode();
}
}
@ -568,7 +568,7 @@ namespace System.Net.Http.Headers
destination ??= new TokenObjectCollection();
destination.Add(valueString.Substring(current, tokenLength));
current = current + tokenLength;
current += tokenLength;
}
// After parsing a valid token list, we expect to have at least one value

View file

@ -225,7 +225,7 @@ namespace System.Net.Http.Headers
}
int current = startIndex + dispositionTypeLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
ContentDispositionHeaderValue contentDispositionHeader = new ContentDispositionHeaderValue();
contentDispositionHeader._dispositionType = dispositionType!;

View file

@ -143,7 +143,7 @@ namespace System.Net.Http.Headers
if (HasLength)
{
result = result ^ _length.GetHashCode();
result ^= _length.GetHashCode();
}
return result;
@ -227,7 +227,7 @@ namespace System.Net.Http.Headers
return 0;
}
current = current + separatorLength;
current += separatorLength;
if (current == input.Length)
{
@ -251,7 +251,7 @@ namespace System.Net.Http.Headers
}
current++; // Skip '/' separator
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
if (current == input.Length)
{
@ -293,10 +293,10 @@ namespace System.Net.Http.Headers
return false;
}
current = current + lengthLength;
current += lengthLength;
}
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
return true;
}
@ -323,8 +323,8 @@ namespace System.Net.Http.Headers
return false;
}
current = current + fromLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += fromLength;
current += HttpRuleParser.GetWhitespaceLength(input, current);
// After the first value, the '-' character must follow.
if ((current == input.Length) || (input[current] != '-'))
@ -334,7 +334,7 @@ namespace System.Net.Http.Headers
}
current++; // skip the '-' character
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
if (current == input.Length)
{
@ -350,10 +350,10 @@ namespace System.Net.Http.Headers
return false;
}
current = current + toLength;
current += toLength;
}
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
return true;
}

View file

@ -143,7 +143,7 @@ namespace System.Net.Http.Headers
}
isWeak = true;
current++; // we have a weak-entity tag.
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
}
int tagStartIndex = current;
@ -165,9 +165,9 @@ namespace System.Net.Http.Headers
parsedValue = new EntityTagHeaderValue(input.Substring(tagStartIndex, tagLength), isWeak);
}
current = current + tagLength;
current += tagLength;
}
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
return current - startIndex;
}

View file

@ -267,14 +267,14 @@ namespace System.Net.Http.Headers
// empty values, continue until the current character is neither a separator nor a whitespace.
separatorFound = true;
current++; // skip delimiter.
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
if (skipEmptyValues)
{
while ((current < input.Length) && (input[current] == ','))
{
current++; // skip delimiter.
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
}
}

View file

@ -168,7 +168,7 @@ namespace System.Net.Http.Headers
}
int current = startIndex + mediaTypeLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
MediaTypeHeaderValue mediaTypeHeader;
// If we're not done and we have a parameter delimiter, then we have a list of parameters.
@ -213,7 +213,7 @@ namespace System.Net.Http.Headers
}
int current = startIndex + typeLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
// Parse the separator between type and subtype
if ((current >= input.Length) || (input[current] != '/'))
@ -221,7 +221,7 @@ namespace System.Net.Http.Headers
return 0;
}
current++; // skip delimiter.
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
// Parse the subtype, i.e. <subtype> in media type string "<type>/<subtype>; param1=value1; param2=value2"
int subtypeLength = HttpRuleParser.GetTokenLength(input, current);

View file

@ -193,7 +193,7 @@ namespace System.Net.Http.Headers
int result = 0;
foreach (var value in values)
{
result = result ^ value.GetHashCode();
result ^= value.GetHashCode();
}
return result;
}
@ -228,7 +228,7 @@ namespace System.Net.Http.Headers
string name = input.Substring(startIndex, nameLength);
int current = startIndex + nameLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
// Parse the separator between name and value
if ((current == input.Length) || (input[current] != '='))
@ -236,12 +236,12 @@ namespace System.Net.Http.Headers
// We only have a name and that's OK. Return.
parsedValue = nameValueCreator();
parsedValue._name = name;
current = current + HttpRuleParser.GetWhitespaceLength(input, current); // skip whitespace
current += HttpRuleParser.GetWhitespaceLength(input, current); // skip whitespace
return current - startIndex;
}
current++; // skip delimiter.
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
// Parse the value, i.e. <value> in name/value string "<name>=<value>"
int valueLength = GetValueLength(input, current);
@ -255,8 +255,8 @@ namespace System.Net.Http.Headers
parsedValue = nameValueCreator();
parsedValue._name = name;
parsedValue._value = input.Substring(current, valueLength);
current = current + valueLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current); // skip whitespace
current += valueLength;
current += HttpRuleParser.GetWhitespaceLength(input, current); // skip whitespace
return current - startIndex;
}
@ -286,8 +286,8 @@ namespace System.Net.Http.Headers
}
nameValueCollection.Add(parameter!);
current = current + nameValueLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += nameValueLength;
current += HttpRuleParser.GetWhitespaceLength(input, current);
if ((current == input.Length) || (input[current] != delimiter))
{
@ -297,7 +297,7 @@ namespace System.Net.Http.Headers
// input[current] is 'delimiter'. Skip the delimiter and whitespace and try to parse again.
current++; // skip delimiter.
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
}
}

View file

@ -114,7 +114,7 @@ namespace System.Net.Http.Headers
}
int current = startIndex + nameValueLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
NameValueWithParametersHeaderValue? nameValueWithParameters =
nameValue as NameValueWithParametersHeaderValue;
Debug.Assert(nameValueWithParameters != null);

View file

@ -76,7 +76,7 @@ namespace System.Net.Http.Headers
if (!string.IsNullOrEmpty(_version))
{
result = result ^ StringComparer.OrdinalIgnoreCase.GetHashCode(_version);
result ^= StringComparer.OrdinalIgnoreCase.GetHashCode(_version);
}
return result;
@ -122,7 +122,7 @@ namespace System.Net.Http.Headers
string name = input.Substring(startIndex, nameLength);
int current = startIndex + nameLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
if ((current == input.Length) || (input[current] != '/'))
{
@ -131,7 +131,7 @@ namespace System.Net.Http.Headers
}
current++; // Skip '/' delimiter.
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += HttpRuleParser.GetWhitespaceLength(input, current);
// Parse the name string: <version> in '<name>/<version>'.
int versionLength = HttpRuleParser.GetTokenLength(input, current);
@ -143,8 +143,8 @@ namespace System.Net.Http.Headers
string version = input.Substring(current, versionLength);
current = current + versionLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += versionLength;
current += HttpRuleParser.GetWhitespaceLength(input, current);
parsedValue = new ProductHeaderValue(name, version);
return current - startIndex;

View file

@ -46,7 +46,7 @@ namespace System.Net.Http.Headers
}
// GetProductInfoLength() already skipped trailing whitespace. No need to do it here again.
current = current + length;
current += length;
// If we have more values, make sure we saw a whitespace before. Values like "product/1.0(comment)" are
// invalid since there must be a whitespace between the product and the comment value.

View file

@ -144,8 +144,8 @@ namespace System.Net.Http.Headers
comment = input.Substring(current, commentLength);
current = current + commentLength;
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
current += commentLength;
current += HttpRuleParser.GetWhitespaceLength(input, current);
parsedValue = new ProductInfoHeaderValue(comment);
}
@ -159,7 +159,7 @@ namespace System.Net.Http.Headers
return 0;
}
current = current + productLength;
current += productLength;
parsedValue = new ProductInfoHeaderValue(product!);
}

View file

@ -139,7 +139,7 @@ namespace System.Net.Http.Headers
return 0;
}
current = current + entityTagLength;
current += entityTagLength;
// RangeConditionHeaderValue only allows 1 value. There must be no delimiter/other chars after an
// entity tag.

Some files were not shown because too many files have changed in this diff Show more