diff --git a/basis/images/png/png.factor b/basis/images/png/png.factor index d4b284142f..b8a9a1d569 100755 --- a/basis/images/png/png.factor +++ b/basis/images/png/png.factor @@ -104,8 +104,7 @@ ERROR: unimplemented-color-type image ; } case ; : load-png ( path -- image ) - [ binary ] [ file-info size>> ] bi - stream-throws [ + binary stream-throws [ read-png-header read-png-chunks diff --git a/basis/io/streams/limited/limited.factor b/basis/io/streams/limited/limited.factor index b1b07a08c0..fd441e4c4d 100755 --- a/basis/io/streams/limited/limited.factor +++ b/basis/io/streams/limited/limited.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math io io.encodings destructors accessors -sequences namespaces byte-vectors fry combinators ; +USING: accessors byte-vectors combinators destructors fry io +io.encodings io.files io.files.info kernel math namespaces +sequences ; IN: io.streams.limited TUPLE: limited-stream stream count limit mode stack ; @@ -16,6 +17,12 @@ SINGLETONS: stream-throws stream-eofs ; swap >>stream 0 >>count ; +: ( path encoding mode -- stream' ) + [ + [ ] + [ drop file-info size>> ] 2bi + ] dip ; + GENERIC# limit 2 ( stream limit mode -- stream' ) M: decoder limit ( stream limit mode -- stream' )