2013-05-04  Paolo Bonzini  <[email protected]>

        * kernel/FileStream.st: Skip the buffer in #nextAvailable:... if
        it is empty.
---
 kernel/FileStream.st | 10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/FileStream.st b/kernel/FileStream.st
index 0c66169..255f76d 100644
--- a/kernel/FileStream.st
+++ b/kernel/FileStream.st
@@ -499,7 +499,10 @@ file object, such as /dev/rmt0 on UNIX or MTA0: on VMS).'>
        <category: 'buffering'>
        | last n |
        writePtr notNil ifTrue: [self flush].
-       ptr > endPtr ifTrue: [self fill].
+       ptr > endPtr ifTrue: [
+            anInteger > collection size
+                ifTrue: [^super nextAvailable: anInteger putAllOn: aStream].
+            self fill].
 
        "Fetch data from the buffer, without doing more than one I/O operation."
        last := endPtr min: ptr + anInteger - 1.
@@ -516,7 +519,10 @@ file object, such as /dev/rmt0 on UNIX or MTA0: on VMS).'>
        <category: 'buffering'>
        | last n |
        writePtr notNil ifTrue: [self flush].
-       ptr > endPtr ifTrue: [self fill].
+       ptr > endPtr ifTrue: [
+            anInteger > collection size
+                ifTrue: [^super nextAvailable: anInteger into: aCollection 
startingAt: pos].
+            self fill].
 
        "Fetch data from the buffer, without doing more than one I/O operation."
        last := endPtr min: ptr + anInteger - 1.
-- 
1.8.2


_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to