Fix in #read:into:at:
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 01 Feb 2012 00:37:59 +0000
changeset 98 bd334e72464f
parent 97 2a7827f4dce2
child 99 677c81c943e4
Fix in #read:into:at:
terminals/Xtreams__PointerReadStream.st
--- a/terminals/Xtreams__PointerReadStream.st	Wed Feb 01 00:34:28 2012 +0000
+++ b/terminals/Xtreams__PointerReadStream.st	Wed Feb 01 00:37:59 2012 +0000
@@ -43,16 +43,21 @@
 !
 
 read: anInteger into: aSequenceableCollection at: startIndex
-	
-	| count |
-	count := self available ifNil: [ anInteger ] ifNotNil: [ :available | available min: anInteger ].
-	source type referentType = UnsignedChar
-		ifTrue: [ source copyAt: position to: aSequenceableCollection size: anInteger startingAt: startIndex. ]
-		ifFalse: [ startIndex to: startIndex + count - 1 do: [ :i | aSequenceableCollection at: i put: self get ] ].
-	position := position + count.
-	^count < anInteger
-		ifTrue: [ (Incomplete on: aSequenceableCollection count: count at: startIndex) raise ]
-		ifFalse: [ count ]
+        
+        | count available |
+        count := (available := self available) isNil ifTrue: [ anInteger ] ifFalse: [ available min: anInteger ].
+        self breakPoint: #jv.
+        self breakPoint: #mk.
+        "There is no UnsignedChar here..."
+        source type referentType = UnsignedChar
+                ifTrue: [ source copyAt: position to: aSequenceableCollection size: anInteger startingAt: startIndex. ]
+                ifFalse: [ startIndex to: startIndex + count - 1 do: [ :i | aSequenceableCollection at: i put: self get ] ].
+        position := position + count.
+        ^count < anInteger
+                ifTrue: [ (Incomplete on: aSequenceableCollection count: count at: startIndex) raise ]
+                ifFalse: [ count ]
+
+    "Modified: / 01-02-2012 / 00:37:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !PointerReadStream methodsFor:'initialize-release'!