Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: David Cantú <dacantu@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
  • Loading branch information
3 people authored Mar 10, 2021
1 parent e8d6f77 commit 7913ebf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public static void LegacySwitchIsHonored()

using (FileStream fileStream = File.Create(filePath))
{
Stream strategy = fileStream
object strategy = fileStream
.GetType()
.GetField("_strategy", BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(fileStream) as Stream;
.GetValue(fileStream);

Assert.DoesNotContain(strategy.GetType().FullName, "Legacy");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected override void OnInitFromHandle(SafeFileHandle handle)
// If, however, we've already bound this file handle to our completion port,
// don't try to bind it again because it will fail. A handle can only be
// bound to a single completion port at a time.
if (!(handle.IsAsync ?? false))
if (handle.IsAsync != true)
{
try
{
Expand Down Expand Up @@ -148,7 +148,7 @@ private unsafe Task<int> ReadAsyncInternal(Memory<byte> destination, Cancellatio
// Make sure we are reading from the position that we think we are
VerifyOSHandlePosition();

if (_filePosition + destination.Length > len)
if (destination.Length > len - _filePosition)
{
if (_filePosition <= len)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public override long Position
EnsureCanSeek();

if (_writePos > 0)
FlushWrite(true);
FlushWrite(performActualFlush: true);

_readPos = 0;
_readLen = 0;
Expand Down

0 comments on commit 7913ebf

Please sign in to comment.