-
-
Notifications
You must be signed in to change notification settings - Fork 969
Fix Seek Operations in SftpFileStream #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
bdcf48b
a6b5e6e
161c87e
731571c
fcf3c56
0cf229a
8d7e004
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,3 +22,6 @@ project.lock.json | |
|
|
||
| # Build outputs | ||
| build/target/ | ||
|
|
||
| # Visual Studio cache/options directory | ||
| .vs/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -788,26 +788,6 @@ public override long Seek(long offset, SeekOrigin origin) | |
| { | ||
| // Flush the write buffer and then seek. | ||
| FlushWriteBuffer(); | ||
|
|
||
| switch (origin) | ||
| { | ||
| case SeekOrigin.Begin: | ||
| newPosn = offset; | ||
| break; | ||
| case SeekOrigin.Current: | ||
| newPosn = _position + offset; | ||
| break; | ||
| case SeekOrigin.End: | ||
| var attributes = _session.RequestFStat(_handle, false); | ||
| newPosn = attributes.Size - offset; | ||
| break; | ||
| } | ||
|
|
||
| if (newPosn == -1) | ||
| { | ||
| throw new EndOfStreamException("End of stream."); | ||
| } | ||
| _position = newPosn; | ||
| } | ||
| else | ||
| { | ||
|
|
@@ -838,29 +818,28 @@ public override long Seek(long offset, SeekOrigin origin) | |
| // Abandon the read buffer. | ||
| _bufferPosition = 0; | ||
| _bufferLen = 0; | ||
| } | ||
|
|
||
| // Seek to the new position. | ||
| switch (origin) | ||
| { | ||
| case SeekOrigin.Begin: | ||
| newPosn = offset; | ||
| break; | ||
| case SeekOrigin.Current: | ||
| newPosn = _position + offset; | ||
| break; | ||
| case SeekOrigin.End: | ||
| var attributes = _session.RequestFStat(_handle, false); | ||
| newPosn = attributes.Size - offset; | ||
| break; | ||
| } | ||
|
|
||
| if (newPosn < 0) | ||
| { | ||
| throw new EndOfStreamException(); | ||
| } | ||
| // Seek to the new position. | ||
| switch (origin) | ||
| { | ||
| case SeekOrigin.Begin: | ||
| newPosn = offset; | ||
| break; | ||
| case SeekOrigin.Current: | ||
| newPosn = _position + offset; | ||
| break; | ||
| case SeekOrigin.End: | ||
| var attributes = _session.RequestFStat(_handle, false); | ||
| newPosn = attributes.Size + offset; | ||
| break; | ||
| } | ||
|
|
||
| _position = newPosn; | ||
| if (newPosn < 0) | ||
| { | ||
| throw new EndOfStreamException("End of stream."); | ||
|
||
| } | ||
| _position = newPosn; | ||
| return _position; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add leading forward slash since this ignore only applies to the root directory of the repo.