Skip to content

Commit

Permalink
Fix TinyBuffer to be non-static
Browse files Browse the repository at this point in the history
[changelog skip]
  • Loading branch information
earlbread committed Nov 20, 2020
1 parent 5a95b76 commit 30cb69d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Bencodex/Decoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Bencodex
{
internal sealed class Decoder
{
private static readonly byte[] TinyBuffer = new byte[1];
private readonly byte[] _tinyBuffer = new byte[1];
private readonly Stream _stream;
private byte _lastRead;
private bool _didBack;
Expand Down Expand Up @@ -193,15 +193,15 @@ private byte[] Read(byte[] buffer)
return _lastRead;
}

int read = _stream.Read(TinyBuffer, 0, 1);
int read = _stream.Read(_tinyBuffer, 0, 1);
if (read > 0)
{
_lastRead = TinyBuffer[0];
_lastRead = _tinyBuffer[0];
}

_offset++;
_didBack = false;
return read == 0 ? (byte?)null : TinyBuffer[0];
return read == 0 ? (byte?)null : _tinyBuffer[0];
}

private void Back()
Expand Down

0 comments on commit 30cb69d

Please sign in to comment.