fix a problem in WXME decoding
Thanks to Robby for the test case and for narrowing down the problem.
This commit is contained in:
parent
7c857706d7
commit
e01e970722
|
@ -381,6 +381,15 @@
|
||||||
(unless recur? (inc-item-count))
|
(unless recur? (inc-item-count))
|
||||||
(let ([s (with-handlers ([exn:fail:read? (lambda (x) #f)])
|
(let ([s (with-handlers ([exn:fail:read? (lambda (x) #f)])
|
||||||
(read si))])
|
(read si))])
|
||||||
|
(when (and recur? s)
|
||||||
|
;; It's ok to have extra whitespace when reading a byte
|
||||||
|
;; string in a sequence
|
||||||
|
(let loop ()
|
||||||
|
(define c (peek-byte si))
|
||||||
|
(unless (eof-object? c)
|
||||||
|
(when (char-whitespace? (integer->char c))
|
||||||
|
(read-byte si)
|
||||||
|
(loop)))))
|
||||||
(if (or (not s)
|
(if (or (not s)
|
||||||
(not (eof-object? (read-byte si))))
|
(not (eof-object? (read-byte si))))
|
||||||
(fail)
|
(fail)
|
||||||
|
|
|
@ -927,6 +927,18 @@
|
||||||
#"")
|
#"")
|
||||||
(expect (send fi2 ok?) #f)
|
(expect (send fi2 ok?) #f)
|
||||||
|
|
||||||
|
(let ()
|
||||||
|
(define (wash-it b)
|
||||||
|
(define out-base (new editor-stream-out-bytes-base%))
|
||||||
|
(define out-stream (make-object editor-stream-out% out-base))
|
||||||
|
(send out-stream put (bytes-length b) b)
|
||||||
|
(define bstr (send out-base get-bytes))
|
||||||
|
(define in-base (make-object editor-stream-in-bytes-base% bstr))
|
||||||
|
(define in-stream (make-object editor-stream-in% in-base))
|
||||||
|
(send in-stream get-unterminated-bytes))
|
||||||
|
(define ex-b #"object ... ;;\351\232\234\347\242\215\347\211\251\345\210\227\350\241\250")
|
||||||
|
(expect (wash-it ex-b) ex-b))
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
;; Save & load
|
;; Save & load
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user