[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-devel-list
Subject: [Mono-devel-list] Patch for System.IO.FileStream
From: ville <vi64pa () kolumbus ! fi>
Date: 2003-05-27 16:48:29
Message-ID: 200305271948.29074.vi64pa () kolumbus ! fi
[Download RAW message or body]
Please somebody review this tiny patch. This fixes Flush() test in
Test/System.IO/FileStreamTest.
ville
["FileStream.cs.diff" (text/x-diff)]
Index: FileStream.cs
===================================================================
RCS file: /cvs/public/mcs/class/corlib/System.IO/FileStream.cs,v
retrieving revision 1.35
diff -u -r1.35 FileStream.cs
--- FileStream.cs 19 May 2003 12:02:10 -0000 1.35
+++ FileStream.cs 27 May 2003 16:57:55 -0000
@@ -343,25 +343,26 @@
if (!CanWrite)
throw new NotSupportedException ("Stream does not support writing");
- int copied = 0;
- while (count > 0) {
- int n = WriteSegment (src, src_offset + copied, count);
- copied += n;
- count -= n;
+
- FlushBuffer ();
+ if (count > buf_size) {
+ // shortcut for long writes
+ MonoIOError error;
- if (count == 0) {
- break;
- }
-
- if (count > buf_size) {
- // shortcut for long writes
- MonoIOError error;
+ MonoIO.Write (handle, src, src_offset, count, out error);
+ buf_start += count;
+ } else {
+
+ int copied = 0;
+ while (count > 0) {
+
+ int n = WriteSegment (src, src_offset + copied, count);
+ copied += n;
+ count -= n;
- MonoIO.Write (handle, src, src_offset + copied, count, out error);
- buf_start += count;
- break;
+ if (count == 0) {
+ break;
+ }
}
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic