fix(build): Attempt to fix possible nullable warnings as errors with releases (#418)
This commit is contained in:
parent
08f05afd01
commit
87764ca968
8 changed files with 23 additions and 11 deletions
|
|
@ -29,7 +29,7 @@ namespace System.Buffers
|
|||
public ref struct SpanWriter
|
||||
{
|
||||
private readonly bool _resize;
|
||||
private byte[]? _arrayToReturnToPool;
|
||||
private byte[] _arrayToReturnToPool;
|
||||
private Span<byte> _buffer;
|
||||
private int _position;
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ namespace System.Buffers
|
|||
|
||||
_buffer.SliceToLength(BytesWritten).CopyTo(poolArray);
|
||||
|
||||
byte[]? toReturn = _arrayToReturnToPool;
|
||||
byte[] toReturn = _arrayToReturnToPool;
|
||||
_buffer = _arrayToReturnToPool = poolArray;
|
||||
if (toReturn != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Server.Buffers
|
|||
{
|
||||
public ref struct ValueStringBuilder
|
||||
{
|
||||
private char[]? _arrayToReturnToPool;
|
||||
private char[] _arrayToReturnToPool;
|
||||
private Span<char> _chars;
|
||||
|
||||
// If this ctor is used, you cannot pass in stackalloc ROS for append/replace.
|
||||
|
|
@ -124,7 +124,7 @@ namespace Server.Buffers
|
|||
Length += count;
|
||||
}
|
||||
|
||||
public void Insert(int index, string? s)
|
||||
public void Insert(int index, string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
|
|
@ -160,7 +160,7 @@ namespace Server.Buffers
|
|||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Append(string? s)
|
||||
public void Append(string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
|
|
@ -180,7 +180,7 @@ namespace Server.Buffers
|
|||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void AppendLine(string? s)
|
||||
public void AppendLine(string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
|
|
@ -275,6 +275,7 @@ namespace Server.Buffers
|
|||
Append(c);
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
/// <summary>
|
||||
/// Resize the internal buffer either by doubling current buffer size or
|
||||
/// by adding <paramref name="additionalCapacityBeyondPos"/> to
|
||||
|
|
@ -290,7 +291,7 @@ namespace Server.Buffers
|
|||
|
||||
_chars.SliceToLength(Length).CopyTo(poolArray);
|
||||
|
||||
char[]? toReturn = _arrayToReturnToPool;
|
||||
char[] toReturn = _arrayToReturnToPool;
|
||||
_chars = _arrayToReturnToPool = poolArray;
|
||||
if (toReturn != null)
|
||||
{
|
||||
|
|
@ -301,13 +302,14 @@ namespace Server.Buffers
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Dispose()
|
||||
{
|
||||
char[]? toReturn = _arrayToReturnToPool;
|
||||
char[] toReturn = _arrayToReturnToPool;
|
||||
this = default; // for safety, to avoid using pooled array if this instance is erroneously appended to again
|
||||
if (toReturn != null)
|
||||
{
|
||||
ArrayPool<char>.Shared.Return(toReturn);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void ReplaceAny(ReadOnlySpan<char> oldChars, ReadOnlySpan<char> newChars, int startIndex, int count)
|
||||
|
|
|
|||
|
|
@ -492,6 +492,7 @@ namespace Server.Collections
|
|||
return index;
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private int TryInsert(int? index, TValue value)
|
||||
{
|
||||
|
|
@ -525,6 +526,7 @@ namespace Server.Collections
|
|||
++_version;
|
||||
return actualIndex;
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
// Returns the index of the next entry in the bucket
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
|
|
@ -2411,6 +2411,7 @@ namespace Server
|
|||
m_PropertyList = null;
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
public void InvalidateProperties()
|
||||
{
|
||||
if (!ObjectPropertyList.Enabled)
|
||||
|
|
@ -2445,6 +2446,7 @@ namespace Server
|
|||
ClearProperties();
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
public virtual int GetPacketFlags()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7398,6 +7398,7 @@ namespace Server
|
|||
m_PropertyList = null;
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
public void InvalidateProperties()
|
||||
{
|
||||
if (!ObjectPropertyList.Enabled)
|
||||
|
|
@ -7432,6 +7433,7 @@ namespace Server
|
|||
ClearProperties();
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
public virtual void SetLocation(Point3D newLocation, bool isTeleport)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Server.Network
|
|||
private bool _finished;
|
||||
private int _count;
|
||||
|
||||
private byte[]? _arrayToReturnToPool;
|
||||
private byte[] _arrayToReturnToPool;
|
||||
private Span<byte> _bytes;
|
||||
|
||||
public PacketContainerBuilder(Span<byte> initialBuffer)
|
||||
|
|
@ -93,7 +93,7 @@ namespace Server.Network
|
|||
|
||||
_bytes.SliceToLength(Length).CopyTo(poolArray);
|
||||
|
||||
byte[]? toReturn = _arrayToReturnToPool;
|
||||
byte[] toReturn = _arrayToReturnToPool;
|
||||
_bytes = _arrayToReturnToPool = poolArray;
|
||||
if (toReturn != null)
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ namespace Server.Network
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Dispose()
|
||||
{
|
||||
byte[]? toReturn = _arrayToReturnToPool;
|
||||
byte[] toReturn = _arrayToReturnToPool;
|
||||
this = default; // for safety, to avoid using pooled array if this instance is erroneously appended to again
|
||||
if (toReturn != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ namespace Server.Commands
|
|||
|
||||
[JsonPropertyName("gfx")] public int ItemID { get; set; }
|
||||
|
||||
#nullable enable
|
||||
[JsonPropertyName("hue")] public int? Hue { get; set; }
|
||||
#nullable disable
|
||||
|
||||
public CAGCategory Parent { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ namespace Server.Commands
|
|||
JsonConfig.Serialize(fileName, list);
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
public static void RecurseExport(List<CAGJson> list, CategoryEntry ce, string category)
|
||||
{
|
||||
category = string.IsNullOrWhiteSpace(category) ? ce.Title : $"{category}{ce.Title}";
|
||||
|
|
@ -153,6 +154,7 @@ namespace Server.Commands
|
|||
RecurseExport(list, subCat, category);
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue