Selaa lähdekoodia

Bug 2181: Allow reads with non-zero offsets with stream returned by Session.GetFile

https://winscp.net/tracker/2181

Source commit: faa66ddd291ed327b928993724d1fd6c373583c0
Martin Prikryl 2 vuotta sitten
vanhempi
sitoutus
9bc4d58da1
1 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 3 3
      dotnet/internal/PipeStream.cs

+ 3 - 3
dotnet/internal/PipeStream.cs

@@ -134,8 +134,8 @@ namespace WinSCP
         ///<exception cref="ArgumentOutOfRangeException">offset or count is negative.</exception>
         public override int Read(byte[] buffer, int offset, int count)
         {
-            if (offset != 0)
-                throw new NotSupportedException("Offsets with value of non-zero are not supported");
+            if (offset < 0)
+                throw new NotSupportedException("Offset cnnot be negative");
             if (buffer == null)
                 throw new ArgumentNullException("buffer");
             if (offset + count > buffer.Length)
@@ -164,7 +164,7 @@ namespace WinSCP
                 // fill the read buffer
                 for (; readLength < count && _buffer.Count > 0; readLength++)
                 {
-                    buffer[readLength] = _buffer.Dequeue();
+                    buffer[offset + readLength] = _buffer.Dequeue();
                 }
 
                 if (_closedWrite)