[Pharo-project] Issue 3680 in pharo: truncated file support in PNMReader

pharo at googlecode.com pharo at googlecode.com
Sun Feb 6 23:19:47 CET 2011

Status: FixedWaitingToBePharoed
Owner: stephane... at gmail.com

New issue 3680 by stephane... at gmail.com: truncated file support in PNMReader

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') -----
        "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') -----
        "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.
                                b = (Character tab) ifTrue:[b := Character  
                                line nextPut: b.
        ^line contents!

More information about the Pharo-project mailing list