refactor: use nullable annotations instead of CanBeNullAttribute

This commit is contained in:
goat 2021-08-22 23:06:46 +02:00
parent 3c5c7fbc80
commit 010a4972cd
No known key found for this signature in database
GPG key ID: F18F057873895461
14 changed files with 33 additions and 62 deletions

View file

@ -75,8 +75,7 @@ namespace Dalamud
/// <param name="address">The address to read from.</param>
/// <param name="count">The length of the array.</param>
/// <returns>An array of the read objects, or null if any entry of the array failed to read.</returns>
[CanBeNull]
public static T[] Read<T>(IntPtr address, int count) where T : struct
public static T[]? Read<T>(IntPtr address, int count) where T : struct
{
var size = SizeOf<T>();
if (!ReadBytes(address, count * size, out var buffer))
@ -132,8 +131,7 @@ namespace Dalamud
/// <param name="address">The address to read from.</param>
/// <param name="maxLength">The maximum length of the string.</param>
/// <returns>The read string, or null in case the read was not successful.</returns>
[CanBeNull]
public static string ReadString(IntPtr address, int maxLength = 256)
public static string? ReadString(IntPtr address, int maxLength = 256)
{
return ReadString(address, Encoding.UTF8, maxLength);
}
@ -150,8 +148,7 @@ namespace Dalamud
/// <param name="encoding">The encoding to use to decode the string.</param>
/// <param name="maxLength">The maximum length of the string.</param>
/// <returns>The read string, or null in case the read was not successful.</returns>
[CanBeNull]
public static string ReadString(IntPtr address, Encoding encoding, int maxLength = 256)
public static string? ReadString(IntPtr address, Encoding encoding, int maxLength = 256)
{
if (!ReadBytes(address, maxLength, out var buffer))
return null;