ReadWriteStream.st
changeset 7114 acc13967229e
parent 5932 6041c11b3370
child 8098 8d1d5cd8529b
--- a/ReadWriteStream.st	Mon Mar 17 17:42:15 2003 +0100
+++ b/ReadWriteStream.st	Mon Mar 17 17:47:00 2003 +0100
@@ -72,8 +72,8 @@
 
     |element|
 
-    (position > readLimit) ifTrue:[^ self pastEnd].
-    element := collection at:position.
+    ((position-ZeroPosition+1) > readLimit) ifTrue:[^ self pastEnd].
+    element := collection at:(position-ZeroPosition+1).
     position := position + 1.
     ^ element
 
@@ -91,8 +91,8 @@
     "return the element to be read next without advancing read position.
      If there are no more elements, nil is returned."
 
-    (position > readLimit) ifTrue:[^ self pastEnd].
-    ^ collection at:position
+    ((position-ZeroPosition+1) > readLimit) ifTrue:[^ self pastEnd].
+    ^ collection at:(position-ZeroPosition+1)
 
     "Modified: 5.2.1996 / 21:57:47 / stefan"
 ! !
@@ -106,7 +106,7 @@
      ST80 users if RWStream expect the contents array to remain
      unchanged."
 
-    readLimit := (readLimit ? 0) max:position-1.
+    readLimit := (readLimit ? 0) max:position-ZeroPosition.
     ^ collection copyFrom:1 to:readLimit
 
     "Created: / 30.10.1997 / 16:25:22 / cg"
@@ -140,7 +140,7 @@
 with:initialCollection
     super with:initialCollection.
     readLimit := initialCollection size.
-    position := 1.
+    position := ZeroPosition.
 ! !
 
 !ReadWriteStream methodsFor:'queries'!
@@ -154,5 +154,5 @@
 !ReadWriteStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ReadWriteStream.st,v 1.21 2001-08-23 21:04:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ReadWriteStream.st,v 1.22 2003-03-17 16:45:14 cg Exp $'
 ! !