Skip to content

Commit

Permalink
Fix NpgsqlReadBuffer.Stream.cs (#5263)
Browse files Browse the repository at this point in the history
  • Loading branch information
vonzshik committed Sep 14, 2023
1 parent 2316c4f commit 070b771
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Npgsql/NpgsqlReadBuffer.Stream.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
Expand Down Expand Up @@ -95,6 +95,7 @@ public override long Seek(long offset, SeekOrigin origin)
var tempPosition = unchecked(_buf.ReadPosition + (int)offset);
if (unchecked(_buf.ReadPosition + offset) < _start || tempPosition < _start)
throw new IOException(seekBeforeBegin);
_buf.ReadPosition = tempPosition;
_read += (int)offset;
return _read;
}
Expand All @@ -103,6 +104,7 @@ public override long Seek(long offset, SeekOrigin origin)
var tempPosition = unchecked(_start + _len + (int)offset);
if (unchecked(_start + _len + offset) < _start || tempPosition < _start)
throw new IOException(seekBeforeBegin);
_buf.ReadPosition = tempPosition;
_read = _len + (int)offset;
return _read;
}
Expand Down

0 comments on commit 070b771

Please sign in to comment.