rumble: fix some type checks in bytes.ss

This commit is contained in:
Gustavo Massaccesi 2018-11-19 14:57:06 -03:00
parent 940e46df6c
commit b4e3030a0d

View File

@ -81,12 +81,14 @@
[(a b . l) [(a b . l)
(check who bytes? a) (check who bytes? a)
(check who bytes? b) (check who bytes? b)
(and (bytevector=? a b) (for-each (lambda (arg)
(check who byte? arg))
l)
(and (do-name a b)
(let loop ([a b] [l l]) (let loop ([a b] [l l])
(cond (cond
[(null? l) #t] [(null? l) #t]
[else (let ([b (car l)]) [else (let ([b (car l)])
(check who bytes? b)
(and (do-name a b) (and (do-name a b)
(loop b (cdr l))))])))]))) (loop b (cdr l))))])))])))
@ -145,14 +147,17 @@
c))] c))]
[(a) [(a)
(check who bytes? a) (check who bytes? a)
a] (#2%bytevector-copy a)]
[() #vu8()] [() #vu8()]
[args [args
(let* ([size (let loop ([args args]) (let* ([size (let loop ([args args])
(cond (cond
[(null? args) 0] [(null? args) 0]
[else (+ (bytevector-length (car args)) [else
(loop (cdr args)))]))] (let ([arg (car args)])
(check who bytes? arg)
(+ (bytevector-length arg)
(loop (cdr args))))]))]
[c (make-bytevector size)]) [c (make-bytevector size)])
(let loop ([args args] [pos 0]) (let loop ([args args] [pos 0])
(cond (cond