Selaa lähdekoodia

Introduce FEATURE_MEMORYSTREAM_TRYGETBUFFER symbol, and clarify doc.

drieseng 9 vuotta sitten
vanhempi
sitoutus
92f8077ee3
1 muutettua tiedostoa jossa 7 lisäystä ja 5 poistoa
  1. 7 5
      src/Renci.SshNet/Common/SshDataStream.cs

+ 7 - 5
src/Renci.SshNet/Common/SshDataStream.cs

@@ -202,7 +202,7 @@ namespace Renci.SshNet.Common
         private byte[] ReadBytes(int length)
         {
             var data = new byte[length];
-            var bytesRead = base.Read(data, 0, length);
+            var bytesRead = Read(data, 0, length);
 
             if (bytesRead < length)
                 throw new ArgumentOutOfRangeException("length");
@@ -214,17 +214,19 @@ namespace Renci.SshNet.Common
         /// Writes the stream contents to a byte array, regardless of the <see cref="MemoryStream.Position"/>.
         /// </summary>
         /// <returns>
-        /// This method returns a copy of the contents of the <see cref="SshDataStream"/> as a byte array.
-        /// If the current instance was constructed on a provided byte array, a copy of the section of the array to which this instance has access is returned.
-        /// TODO
+        /// This method returns the contents of the <see cref="SshDataStream"/> as a byte array.
         /// </returns>
+        /// <remarks>
+        /// If the current instance was constructed on a provided byte array, a copy of the section of the array
+        /// to which this instance has access is returned.
+        /// </remarks>
         public override byte[] ToArray()
         {
             if (Capacity == Length)
             {
 #if FEATURE_MEMORYSTREAM_GETBUFFER
                 return GetBuffer();
-#else
+#elif FEATURE_MEMORYSTREAM_TRYGETBUFFER
                 ArraySegment<byte> buffer;
                 if (TryGetBuffer(out buffer))
                     return buffer.Array;