Status: FixedWaitingToBePharoed
Owner: [email protected]

New issue 3680 by [email protected]: truncated file support in PNMReader
http://code.google.com/p/pharo/issues/detail?id=3680

this was not integrated in Squeak but it may be useful.
We should check the license.


Name: Graphics-jdr.177
Author: jdr
Time: 21 January 2011, 11:48:51.942 am
UUID: 82017dd9-eb5e-4170-b183-14122bb13439
Ancestors: Graphics-jdr.176

Bug reading a truncated file, added pgm extension

=============== Diff against Graphics-jdr.176 ===============

Item was changed:
----- Method: PNMReadWriter class>>typicalFileExtensions (in category 'image reading/writing') -----
 typicalFileExtensions
"Answer a collection of file extensions (lowercase) which files that I can read might commonly have"
+       ^#('pbm' 'pgm' 'pnm' 'ppm' 'pam')!
-       ^#('pbm' 'pnm' 'ppm' 'pam')!

Item was changed:
 ----- Method: PNMReadWriter>>cleanLine (in category 'reading') -----
 cleanLine
       "upTo LF or CR, tab as space"

       | line loop b |
+       stream atEnd ifTrue:[self error:'End of Data'].
+
       line := WriteStream with: ''.
       loop := true.
       [loop] whileTrue: [
               b := stream next.
               b ifNil:[
                       loop := false           "EOS"
               ]
               ifNotNil: [
                       (b = (Character cr) or:[b = Character lf]) ifTrue:[
                               loop := false.
                       ]
                       ifFalse:[
b = (Character tab) ifTrue:[b := Character space].
                               line nextPut: b.
                       ]
               ]
       ].
       ^line contents!



Reply via email to