diff --git a/xenomorph/xenomorph/array.rkt b/xenomorph/xenomorph/array.rkt index 7e87ac68..4a53f90f 100644 --- a/xenomorph/xenomorph/array.rkt +++ b/xenomorph/xenomorph/array.rkt @@ -32,7 +32,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Array.coffee '_currentOffset 0 '_length @len) parent)) - (define len (resolve-length @len #:parent parent)) + (define len (resolve-length @len port #:parent parent)) (cond [(or (not len) (eq? @length-type 'bytes)) (define end-pos (cond diff --git a/xenomorph/xenomorph/buffer.rkt b/xenomorph/xenomorph/buffer.rkt index 0dec0391..f0eb9d9d 100644 --- a/xenomorph/xenomorph/buffer.rkt +++ b/xenomorph/xenomorph/buffer.rkt @@ -15,7 +15,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Buffer.coffee (raise-argument-error '+xbuffer "resolvable length" @len)) (define/augment (xxdecode port parent) - (define len (resolve-length @len #:parent parent)) + (define len (resolve-length @len port #:parent parent)) (read-bytes len)) (define/augment (xxencode buf port [parent #f]) diff --git a/xenomorph/xenomorph/lazy-array.rkt b/xenomorph/xenomorph/lazy-array.rkt index 23ebc5e6..3e92d67b 100644 --- a/xenomorph/xenomorph/lazy-array.rkt +++ b/xenomorph/xenomorph/lazy-array.rkt @@ -15,7 +15,7 @@ https://github.com/mbutterick/restructure/blob/master/src/LazyArray.coffee (define/override (xxdecode port parent) (define starting-pos (pos port)) ; ! placement matters. `resolve-length` will change `pos` - (define len (resolve-length @len #:parent parent)) + (define len (resolve-length @len port #:parent parent)) (define new-parent (if (xint? @len) (mhasheq 'parent parent '_startOffset starting-pos diff --git a/xenomorph/xenomorph/util.rkt b/xenomorph/xenomorph/util.rkt index 8903f70f..e4df07ec 100644 --- a/xenomorph/xenomorph/util.rkt +++ b/xenomorph/xenomorph/util.rkt @@ -5,7 +5,7 @@ (define (length-resolvable? x) (or (not x) (symbol? x) (xenomorphic? x) (procedure? x) (exact-nonnegative-integer? x))) -(define (resolve-length x [port (current-input-port)] #:parent [parent #f]) +(define (resolve-length x port #:parent [parent #f]) (cond [(not x) #f] [(exact-nonnegative-integer? x) x]