mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-01 05:13:40 +01:00
refactor: use nullable annotations instead of CanBeNullAttribute
This commit is contained in:
parent
3c5c7fbc80
commit
010a4972cd
14 changed files with 33 additions and 62 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue