fix some uses of peek-bytes-avail!
that do not expect specials
Closes #3572
This commit is contained in:
parent
c93e4f1328
commit
0041354e1f
|
@ -1605,6 +1605,19 @@
|
||||||
(#"^(E)?(?(1)aa|a)*$" #"aaa" (#"aaa" #f))
|
(#"^(E)?(?(1)aa|a)*$" #"aaa" (#"aaa" #f))
|
||||||
(#"^(E)?(?(1)aa|a)*$" #"aaaa" (#"aaaa" #f))))
|
(#"^(E)?(?(1)aa|a)*$" #"aaaa" (#"aaaa" #f))))
|
||||||
|
|
||||||
|
|
||||||
|
(let ()
|
||||||
|
(define out (open-output-bytes))
|
||||||
|
(define infinite-voids
|
||||||
|
(make-input-port
|
||||||
|
'voids
|
||||||
|
(lambda (s) (lambda args 'void))
|
||||||
|
(lambda (skip s evt) (lambda args 'void))
|
||||||
|
void))
|
||||||
|
(err/rt-test (regexp-match #rx"." infinite-voids)
|
||||||
|
exn:fail:contract?
|
||||||
|
#rx"non-character in an unsupported context"))
|
||||||
|
|
||||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Test unicode-property patterns
|
;; Test unicode-property patterns
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
(require file/unzip
|
(require file/unzip
|
||||||
|
file/gunzip
|
||||||
racket/runtime-path
|
racket/runtime-path
|
||||||
racket/port
|
racket/port
|
||||||
tests/eli-tester)
|
tests/eli-tester)
|
||||||
|
@ -27,7 +28,18 @@
|
||||||
(call-with-input-file* unzip-me.zip test-with-unzip)
|
(call-with-input-file* unzip-me.zip test-with-unzip)
|
||||||
(call-with-input-file* unzip-me.zip
|
(call-with-input-file* unzip-me.zip
|
||||||
(lambda(in_port) (test-with-unzip (input-port-append #f in_port))))
|
(lambda(in_port) (test-with-unzip (input-port-append #f in_port))))
|
||||||
(test-with-unzip-entry))
|
(test-with-unzip-entry)
|
||||||
|
|
||||||
|
(test (let ()
|
||||||
|
(define out (open-output-bytes))
|
||||||
|
(define infinite-voids
|
||||||
|
(make-input-port
|
||||||
|
'voids
|
||||||
|
(lambda (s) (lambda args 'void))
|
||||||
|
(lambda (skip s evt) (lambda args 'void))
|
||||||
|
void))
|
||||||
|
(inflate infinite-voids out))
|
||||||
|
=error> "non-character in an unsupported context"))
|
||||||
|
|
||||||
(provide tests)
|
(provide tests)
|
||||||
(module+ main (tests))
|
(module+ main (tests))
|
||||||
|
|
|
@ -288,13 +288,18 @@
|
||||||
(set! buf-pos (min MAX-LOOKAHEAD buf-max)))
|
(set! buf-pos (min MAX-LOOKAHEAD buf-max)))
|
||||||
;; Peek (not read) some available bytes:
|
;; Peek (not read) some available bytes:
|
||||||
(let ([got (peek-bytes-avail! buffer buf-pos #f input-port buf-pos BUFFER-SIZE)])
|
(let ([got (peek-bytes-avail! buffer buf-pos #f input-port buf-pos BUFFER-SIZE)])
|
||||||
(if (eof-object? got)
|
(cond
|
||||||
|
[(eof-object? got)
|
||||||
;; Treat an EOF as a -1 "byte":
|
;; Treat an EOF as a -1 "byte":
|
||||||
(begin
|
|
||||||
(bytes-set! buffer buf-pos 255)
|
(bytes-set! buffer buf-pos 255)
|
||||||
(set! buf-max (add1 buf-pos)))
|
(set! buf-max (add1 buf-pos))]
|
||||||
|
[(fixnum? got)
|
||||||
;; Got normal bytes:
|
;; Got normal bytes:
|
||||||
(set! buf-max (+ buf-pos got))))
|
(set! buf-max (+ buf-pos got))]
|
||||||
|
[else
|
||||||
|
(raise-arguments-error 'inflate
|
||||||
|
"non-character in an unsupported context"
|
||||||
|
"port" input-port)]))
|
||||||
(READBITS n))
|
(READBITS n))
|
||||||
(let ([v (bytes-ref buffer buf-pos)])
|
(let ([v (bytes-ref buffer buf-pos)])
|
||||||
(set! buf-pos (add1 buf-pos))
|
(set! buf-pos (add1 buf-pos))
|
||||||
|
|
|
@ -5028,13 +5028,19 @@
|
||||||
len_0))))))
|
len_0))))))
|
||||||
(if (eof-object? n_0)
|
(if (eof-object? n_0)
|
||||||
#f
|
#f
|
||||||
|
(if (not (fixnum? n_0))
|
||||||
|
(raise-arguments-error
|
||||||
|
'regexp-match
|
||||||
|
"non-character in an unsupported context"
|
||||||
|
"port"
|
||||||
|
(lazy-bytes-in s_0))
|
||||||
(if (zero? n_0)
|
(if (zero? n_0)
|
||||||
(begin (set-lazy-bytes-failed?! s_0 #t) #f)
|
(begin (set-lazy-bytes-failed?! s_0 #t) #f)
|
||||||
(begin
|
(begin
|
||||||
(set-lazy-bytes-end!
|
(set-lazy-bytes-end!
|
||||||
s_0
|
s_0
|
||||||
(+ n_0 len_0 discarded-count_0))
|
(+ n_0 len_0 discarded-count_0))
|
||||||
#t))))
|
#t)))))
|
||||||
(let ((max-peek_0 (lazy-bytes-max-peek s_0)))
|
(let ((max-peek_0 (lazy-bytes-max-peek s_0)))
|
||||||
(let ((prefix-len_0
|
(let ((prefix-len_0
|
||||||
(if max-peek_0 (lazy-bytes-prefix-len s_0) #f)))
|
(if max-peek_0 (lazy-bytes-prefix-len s_0) #f)))
|
||||||
|
|
|
@ -113,6 +113,10 @@
|
||||||
len))
|
len))
|
||||||
(cond
|
(cond
|
||||||
[(eof-object? n) #f]
|
[(eof-object? n) #f]
|
||||||
|
[(not (fixnum? n))
|
||||||
|
(raise-arguments-error 'regexp-match
|
||||||
|
"non-character in an unsupported context"
|
||||||
|
"port" (lazy-bytes-in s))]
|
||||||
[(zero? n)
|
[(zero? n)
|
||||||
;; would block or progress evt became ready
|
;; would block or progress evt became ready
|
||||||
(set-lazy-bytes-failed?! s #t)
|
(set-lazy-bytes-failed?! s #t)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user