Skip to content

Commit

Permalink
image: always read exactly n bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
nomennescio committed May 24, 2024
1 parent 6548879 commit 2f62186
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extra/tools/image/image.factor
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ ERROR: unsupported-image-header ;
dup code>> length over header>> compressed-code-size<<
;

! return empty sequence instead of f
! always read exactly n bytes. return empty sequence instead of f. beyond EOF read 0.
: read* ( n -- bytes )
read [ B{ } clone ] unless* ; inline
dup read [ B{ } clone ] unless* resize-byte-array ; inline

: read-header ( -- header/* )
image-header read-struct check-header >compression-header ;
Expand Down

0 comments on commit 2f62186

Please sign in to comment.