diff --git a/SharpNBT/TagReader.cs b/SharpNBT/TagReader.cs
index dc2837a..d6206ff 100644
--- a/SharpNBT/TagReader.cs
+++ b/SharpNBT/TagReader.cs
@@ -16,12 +16,12 @@ public class TagReader : TagIO
///
/// Occurs when a tag has been fully deserialized from the stream.
///
- public event TagReaderCallback TagRead;
+ public event TagReaderCallback? TagRead;
///
/// Occurs when a tag has been encountered in the stream, after reading the first byte to determine its .
///
- public event TagReaderCallback TagEncountered;
+ public event TagReaderCallback? TagEncountered;
private readonly bool leaveOpen;
@@ -189,8 +189,6 @@ public class TagReader : TagIO
/// The deserialized instance.
public IntArrayTag ReadIntArray(bool named = true)
{
- const int INT_SIZE = sizeof(int);
-
var name = named ? ReadUTF8String() : null;
var count = ReadCount();
@@ -202,8 +200,8 @@ public class TagReader : TagIO
return new IntArrayTag(name, array);
}
- var buffer = new byte[count * INT_SIZE];
- ReadToFixSizedBuffer(buffer, 0, count * INT_SIZE);
+ var buffer = new byte[count * sizeof(int)];
+ ReadToFixSizedBuffer(buffer, 0, count * sizeof(int));
Span values = MemoryMarshal.Cast(buffer);
if (SwapEndian)
@@ -222,8 +220,6 @@ public class TagReader : TagIO
/// The deserialized instance.
public LongArrayTag ReadLongArray(bool named = true)
{
- const int LONG_SIZE = sizeof(long);
-
var name = named ? ReadUTF8String() : null;
var count = ReadCount();
@@ -235,8 +231,8 @@ public class TagReader : TagIO
return new LongArrayTag(name, array);
}
- var buffer = new byte[count * LONG_SIZE];
- ReadToFixSizedBuffer(buffer, 0, count * LONG_SIZE);
+ var buffer = new byte[count * sizeof(long)];
+ ReadToFixSizedBuffer(buffer, 0, count * sizeof(long));
Span values = MemoryMarshal.Cast(buffer);
if (SwapEndian)