reegxp-match: fix problem with lazy string decoding and output port

Closes PR 14684
This commit is contained in:
Matthew Flatt 2014-08-13 13:28:51 +01:00
parent f865da8d10
commit 906ba45c6c
2 changed files with 5 additions and 4 deletions

View File

@ -1330,18 +1330,19 @@
;; Check that lazy decoding of strings works right with sending
;; unmatched output to a port:
(for ([succeed? '(#f #t)])
(for* ([succeed? '(#f #t)]
[char '(#\x #\u3BB)])
(for ([N '(1 100 1000 1023 1024 10000)])
(for ([M (list 0 (quotient N 2))])
(define o (open-output-bytes))
(void (regexp-match-positions #rx"y"
(string-append
(make-string N #\x)
(make-string N char)
(if succeed? "y" ""))
M
(+ N (if succeed? 1 0))
o))
(test (- N M) bytes-length (get-output-bytes o)))))
(test (- N M) string-length (get-output-string o)))))
(arity-test regexp 1 1)
(arity-test regexp? 1 1)

View File

@ -5388,7 +5388,7 @@ static Scheme_Object *gen_compare(char *name, int pos,
if (lazy_string) {
full_s = lazy_string->s;
endset = lazy_string->end - lazy_string->start;
endset = lazy_string->blen;
}
if (iport) {