On Nov 5, 2010, at 10:30 AM, Igor Stasenko wrote:
On 5 November 2010 11:20, Benjamin <[email protected]
> wrote:
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 ?
yes.
I'd say the whole method is a bug. Repeating
aString asString multiple times in code cries out of loud that it
could be anything but not right :)
I think so ^^
I'll create a bug entry
Ben
Regards,
Ben
--
Best regards,
Igor Stasenko AKA sig.