Status: New
Owner: ----

New issue 3458 by mmk.bbt: bug in the class MultiByteFileStream when Pharo running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

PharoCore-1.2beta-12272, Windows

Steps to reproduce:
(MultiByteFileStream new)
 wantsLineEndConversion: true;
 open: 'c:\temp\1.txt' forWrite: true;
 cr;
 close.


 File c:\temp\1.txt contains 3 characters (cr lf lf) instead of two (cr lf).
This is due to the fact that the method MultiByteFileStream>> nextPut: There is a double conversion of Cr to CrLf.
 I think this can be corrected as follows:

 "
 MultiByteFileStream>> nextPut: aCharacter
       aCharacter isInteger
                 ifTrue: [^ super nextPut: aCharacter].
(wantsLineEndConversion == true and: [lineEndConvention notNil]) "# doConversion is inlined here"
                  ifTrue: [
                              aCharacter = Cr
ifTrue: [converter nextPutAll: (LineEndStrings at: # cr) toStream: self] ifFalse: [converter nextPut: aCharacter toStream: self].
                              ^ aCharacter].
       ^ Self converter nextPut: aCharacter toStream: self
 "

 Sincerely,
 Maxim




Paste or attach stack trace if applicable (look at the file PharoDebug.log
located in the same directory as your image):



Reply via email to