[Pharo-project] WriteStream

Benjamin benjamin.vanryseghem.pharo at gmail.com
Fri Nov 5 10:20:28 CET 2010


Hello everyone,

I thing, there is a bug in WriteStream, but i'm not sure.
When I look at this code, I guess aString is not always a String, and  
yesterday, I had a Text send to this method, which raised a DNU error.

(in blue is what I have change to make it work in my case)

	WriteStream>>nextChunkPut: aString
	"Append the argument, aString, to the receiver, doubling embedded  
terminators."

	| i remainder terminator |
	terminator := $!.
	remainder := aString asString.
	[(i := remainder indexOf: terminator) = 0] whileFalse:
		[self nextPutAll: (remainder copyFrom: 1 to: i).
		self nextPut: terminator.  "double imbedded terminators"
		remainder := remainder copyFrom: i+1 to: remainder size].
	self nextPutAll: remainder.
aString asString includesUnifiedCharacter ifTrue: [
		self nextPut: terminator.
		self nextPutAll: ']lang['.
		aString asString writeLeadingCharRunsOn: self.
	].
	self nextPut: terminator.



Is that a bug ?


Regards,

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20101105/f7f8ae75/attachment.htm>


More information about the Pharo-project mailing list