Skip to content

Commit

Permalink
Feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch committed Dec 10, 2024
1 parent 1e27964 commit aa8b18a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions bin/pngdiff.toit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by an MIT-style license that can be
// found in the LICENSE file.
import io show BIG-ENDIAN Reader
import io show BIG-ENDIAN CloseableReader
import bitmap
import cli
import host.file
Expand Down Expand Up @@ -214,10 +214,11 @@ MAX-OUT := ByteArray 0x100: it == 0 ? 0 : 0xff

slurp-file file-name/string --debug/bool -> PngRgba:
error := catch --unwind=debug:
reader/Reader := file-name == "-"
reader/CloseableReader := file-name == "-"
? pipe.stdin.in
: (file.Stream.for-read file-name).in
contents := reader.read-all
reader.close
png := PngRgba contents
return png
if error:
Expand Down
5 changes: 3 additions & 2 deletions bin/pnginfo.toit
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import cli
import host.file
import host.pipe
import io show Reader
import io show CloseableReader
import encoding.json
import png-tools.png-reader show *
import png-tools.png-writer show PngWriter
Expand Down Expand Up @@ -288,10 +288,11 @@ show-image-data png/PngRgba out-stream -> none:

slurp-file file-name/string --debug/bool --include-image-data/bool=false -> List:
error := catch --unwind=debug:
reader/Reader := file-name == "-"
reader/CloseableReader := file-name == "-"
? pipe.stdin.in
: (file.Stream.for-read file-name).in
contents := reader.read-all
reader.close
info := PngInfo contents
if not include-image-data: return [info]
return [info, PngRgba contents]
Expand Down
5 changes: 3 additions & 2 deletions bin/pngunzip.toit
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import bitmap
import cli
import host.file
import host.pipe
import io show Reader
import io show CloseableReader
import png-tools.png-reader show Png COLOR-TYPE-INDEXED COLOR-TYPE-GRAYSCALE
import png-tools.png-writer show PngWriter
import .version
Expand Down Expand Up @@ -156,10 +156,11 @@ MAX-OUT := ByteArray 0x100: it == 0 ? 0 : 0xff

slurp-file file-name/string --debug/bool -> Png:
error := catch --unwind=debug:
reader/Reader := file-name == "-"
reader/CloseableReader := file-name == "-"
? pipe.stdin.in
: (file.Stream.for-read file-name).in
contents := reader.read-all
reader.close
png := Png contents
return png
if error:
Expand Down

0 comments on commit aa8b18a

Please sign in to comment.