Skip to content

Commit a9cbfef

Browse files
committed
remaining changes
1 parent a830287 commit a9cbfef

File tree

43 files changed

+381
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+381
-381
lines changed

src/libraries/Common/src/Interop/Unix/Interop.Errors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ internal ErrorInfo(Error error)
130130
_rawErrno = -1;
131131
}
132132

133-
internal Error Error
133+
internal readonly Error Error
134134
{
135135
get { return _error; }
136136
}

src/libraries/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal struct GssBuffer : IDisposable
1616
internal ulong _length;
1717
internal IntPtr _data;
1818

19-
internal int Copy(byte[] destination, int offset)
19+
internal readonly int Copy(byte[] destination, int offset)
2020
{
2121
Debug.Assert(destination != null, "target destination cannot be null");
2222
Debug.Assert((offset >= 0 && offset < destination.Length) || destination.Length == 0, "invalid offset " + offset);
@@ -38,7 +38,7 @@ internal int Copy(byte[] destination, int offset)
3838
return sourceLength;
3939
}
4040

41-
internal byte[] ToByteArray()
41+
internal readonly byte[] ToByteArray()
4242
{
4343
if (_data == IntPtr.Zero || _length == 0)
4444
{
@@ -51,7 +51,7 @@ internal byte[] ToByteArray()
5151
return destination;
5252
}
5353

54-
internal unsafe ReadOnlySpan<byte> Span => (_data != IntPtr.Zero && _length != 0) ?
54+
internal unsafe readonly ReadOnlySpan<byte> Span => (_data != IntPtr.Zero && _length != 0) ?
5555
new ReadOnlySpan<byte>(_data.ToPointer(), checked((int)_length)) :
5656
default;
5757

src/libraries/Common/src/Interop/Windows/Advapi32/Interop.PERF_INFO.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ internal struct SYSTEMTIME
9797
internal short wSecond;
9898
internal short wMilliseconds;
9999

100-
public override string ToString()
100+
public override readonly string ToString()
101101
{
102102
return "[SYSTEMTIME: "
103103
+ wDay.ToString(CultureInfo.CurrentCulture) + "/" + wMonth.ToString(CultureInfo.CurrentCulture) + "/" + wYear.ToString(CultureInfo.CurrentCulture)

src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CRYPT_BIT_BLOB.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal struct CRYPT_BIT_BLOB
1515
internal IntPtr pbData;
1616
internal int cUnusedBits;
1717

18-
internal byte[] ToByteArray()
18+
internal readonly byte[] ToByteArray()
1919
{
2020
int numBytes = cbData;
2121
byte[] data = new byte[numBytes];

src/libraries/Common/src/Interop/Windows/Crypt32/Interop.FindOidInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ internal struct CRYPT_OID_INFO
2121
public int cbData;
2222
public IntPtr pbData;
2323

24-
public string? OID
24+
public readonly string? OID
2525
{
2626
get
2727
{
2828
return Marshal.PtrToStringAnsi(pszOID);
2929
}
3030
}
3131

32-
public string? Name
32+
public readonly string? Name
3333
{
3434
get
3535
{

src/libraries/Common/src/Interop/Windows/Gdi32/Interop.RECT.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public struct RECT
1616
public int right;
1717
public int bottom;
1818

19-
public Size Size => new Size(right - left, bottom - top);
19+
public readonly Size Size => new Size(right - left, bottom - top);
2020
}
2121
}
2222
}

src/libraries/Common/src/Interop/Windows/Interop.LongFileTime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ internal struct LongFileTime
2222
internal long TicksSince1601;
2323
#pragma warning restore CS0649
2424

25-
internal DateTimeOffset ToDateTimeOffset() => new DateTimeOffset(DateTime.FromFileTimeUtc(TicksSince1601));
25+
internal readonly DateTimeOffset ToDateTimeOffset() => new DateTimeOffset(DateTime.FromFileTimeUtc(TicksSince1601));
2626
}
2727
}

src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.NetworkInformation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal struct IpSocketAddress
5858
internal IntPtr address;
5959
internal int addressLength;
6060

61-
internal IPAddress MarshalIPAddress()
61+
internal readonly IPAddress MarshalIPAddress()
6262
{
6363
// Determine the address family used to create the IPAddress.
6464
AddressFamily family = (addressLength > Internals.SocketAddress.IPv4AddressSize)

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.FILE_TIME.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ internal FILE_TIME(long fileTime)
1818
dwHighDateTime = (uint)(fileTime >> 32);
1919
}
2020

21-
internal long ToTicks() => ((long)dwHighDateTime << 32) + dwLowDateTime;
22-
internal DateTime ToDateTimeUtc() => DateTime.FromFileTimeUtc(ToTicks());
23-
internal DateTimeOffset ToDateTimeOffset() => DateTimeOffset.FromFileTime(ToTicks());
21+
internal readonly long ToTicks() => ((long)dwHighDateTime << 32) + dwLowDateTime;
22+
internal readonly DateTime ToDateTimeUtc() => DateTime.FromFileTimeUtc(ToTicks());
23+
internal readonly DateTimeOffset ToDateTimeOffset() => DateTimeOffset.FromFileTime(ToTicks());
2424
}
2525
}
2626
}

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.TimeZone.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal struct SYSTEMTIME
1818
internal ushort Second;
1919
internal ushort Milliseconds;
2020

21-
internal bool Equals(in SYSTEMTIME other) =>
21+
internal readonly bool Equals(in SYSTEMTIME other) =>
2222
Year == other.Year &&
2323
Month == other.Month &&
2424
DayOfWeek == other.DayOfWeek &&
@@ -42,7 +42,7 @@ internal unsafe struct TIME_DYNAMIC_ZONE_INFORMATION
4242
internal fixed char TimeZoneKeyName[128];
4343
internal byte DynamicDaylightTimeDisabled;
4444

45-
internal string GetTimeZoneKeyName()
45+
internal readonly string GetTimeZoneKeyName()
4646
{
4747
fixed (char* p = TimeZoneKeyName)
4848
return new string(p);
@@ -68,13 +68,13 @@ internal TIME_ZONE_INFORMATION(in TIME_DYNAMIC_ZONE_INFORMATION dtzi)
6868
*pTo = *(TIME_ZONE_INFORMATION*)pFrom;
6969
}
7070

71-
internal string GetStandardName()
71+
internal readonly string GetStandardName()
7272
{
7373
fixed (char* p = StandardName)
7474
return new string(p);
7575
}
7676

77-
internal string GetDaylightName()
77+
internal readonly string GetDaylightName()
7878
{
7979
fixed (char* p = DaylightName)
8080
return new string(p);

src/libraries/Common/src/Interop/Windows/NtDll/Interop.FILE_FULL_DIR_INFORMATION.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public struct FILE_FULL_DIR_INFORMATION
5454
public uint EaSize;
5555

5656
private char _fileName;
57-
public unsafe ReadOnlySpan<char> FileName { get { fixed (char* c = &_fileName) { return new ReadOnlySpan<char>(c, (int)FileNameLength / sizeof(char)); } } }
57+
public unsafe readonly ReadOnlySpan<char> FileName { get { fixed (char* c = &_fileName) { return new ReadOnlySpan<char>(c, (int)FileNameLength / sizeof(char)); } } }
5858

5959
/// <summary>
6060
/// Gets the next info pointer or null if there are no more.

src/libraries/Common/src/Interop/Windows/Ole32/Interop.STATSTG.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal struct STATSTG
5959
public uint grfStateBits;
6060
public uint reserved;
6161

62-
public string? GetName() => Marshal.PtrToStringUni(pwcsName);
62+
public readonly string? GetName() => Marshal.PtrToStringUni(pwcsName);
6363

6464
/// <summary>
6565
/// Caller is responsible for freeing the name memory.

src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal struct CredHandle
2323
private IntPtr dwLower;
2424
private IntPtr dwUpper;
2525

26-
public bool IsZero
26+
public readonly bool IsZero
2727
{
2828
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2929
get
@@ -38,7 +38,7 @@ internal void SetToInvalid()
3838
dwUpper = IntPtr.Zero;
3939
}
4040

41-
public override string ToString()
41+
public override readonly string ToString()
4242
{
4343
{ return dwLower.ToString("x") + ":" + dwUpper.ToString("x"); }
4444
}

src/libraries/Common/src/System/MutableDecimal.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ internal struct MutableDecimal
2323

2424
public bool IsNegative
2525
{
26-
get { return (Flags & SignMask) != 0; }
26+
readonly get { return (Flags & SignMask) != 0; }
2727
set { Flags = (Flags & ~SignMask) | (value ? SignMask : 0); }
2828
}
2929

3030
public int Scale
3131
{
32-
get { return (byte)(Flags >> ScaleShift); }
32+
readonly get { return (byte)(Flags >> ScaleShift); }
3333
set { Flags = (Flags & ~ScaleMask) | ((uint)value << ScaleShift); }
3434
}
3535

0 commit comments

Comments
 (0)