Skip to content

Commit

Permalink
more warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Morilli committed Nov 3, 2023
1 parent fa75f32 commit f14aa27
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/BizHawk.Client.Common/rewind/ZeldaWinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ private void MaybeResize(int requestedSize)
_dest = replacement;
}
}
#if NET6_0_OR_GREATER
public override void Write(ReadOnlySpan<byte> buffer)
#else
public void Write(ReadOnlySpan<byte> buffer)
#endif
{
var requestedSize = _position + buffer.Length;
MaybeResize(requestedSize);
Expand All @@ -305,7 +309,11 @@ public override void WriteByte(byte value)
_dest[_position] = value;
_position = requestedSize;
}
#if NET6_0_OR_GREATER
public override int Read(Span<byte> buffer) => throw new IOException();
#else
public int Read(Span<byte> buffer) => throw new IOException();
#endif
}
}
}
18 changes: 17 additions & 1 deletion src/BizHawk.Client.Common/rewind/ZwinderBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private int ComputeIdealRewindInterval()
{
return 1; // shrug
}

if (_fixedRewindInterval)
{
return _targetRewindInterval;
Expand Down Expand Up @@ -436,14 +436,22 @@ public override void Flush() {}
public override int Read(byte[] buffer, int offset, int count) => throw new IOException();
public override long Seek(long offset, SeekOrigin origin) => throw new IOException();
public override void SetLength(long value) => throw new IOException();
#if NET6_0_OR_GREATER
public override int Read(Span<byte> buffer) => throw new IOException();
#else
public int Read(Span<byte> buffer) => throw new IOException();
#endif

public override void Write(byte[] buffer, int offset, int count)
{
Write(new ReadOnlySpan<byte>(buffer, offset, count));
}

#if NET6_0_OR_GREATER
public override void Write(ReadOnlySpan<byte> buffer)
#else
public void Write(ReadOnlySpan<byte> buffer)
#endif
{
long requestedSize = _position + buffer.Length;
while (requestedSize > _notifySize)
Expand Down Expand Up @@ -519,7 +527,11 @@ public override int Read(byte[] buffer, int offset, int count)
return Read(new Span<byte>(buffer, offset, count));
}

#if NET6_0_OR_GREATER
public override int Read(Span<byte> buffer)
#else
public int Read(Span<byte> buffer)
#endif
{
long n = Math.Min(_size - _position, buffer.Length);
int ret = (int)n;
Expand Down Expand Up @@ -570,7 +582,11 @@ public override int ReadByte()
public override void SetLength(long value) => throw new IOException();
public override void Write(byte[] buffer, int offset, int count) => throw new IOException();

#if NET6_0_OR_GREATER
public override void Write(ReadOnlySpan<byte> buffer) => throw new IOException();
#else
public void Write(ReadOnlySpan<byte> buffer) => throw new IOException();
#endif
}
}
}
8 changes: 8 additions & 0 deletions src/BizHawk.Common/MemoryBlock/MemoryViewStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ public override void Flush()
private byte* CurrentPointer()
=> (byte*)Z.SS(_ptr + _pos);

#if NET6_0_OR_GREATER
public override int Read(Span<byte> buffer)
#else
public int Read(Span<byte> buffer)
#endif
{
if (!_readable)
{
Expand Down Expand Up @@ -106,7 +110,11 @@ public override long Seek(long offset, SeekOrigin origin)
public override void SetLength(long value)
=> throw new IOException();

#if NET6_0_OR_GREATER
public override void Write(ReadOnlySpan<byte> buffer)
#else
public void Write(ReadOnlySpan<byte> buffer)
#endif
{
if (!_writable)
{
Expand Down

0 comments on commit f14aa27

Please sign in to comment.