From: Chris Hanson Date: Wed, 3 May 2017 07:17:18 +0000 (-0700) Subject: Change mime-coded to use regsexp. X-Git-Tag: mit-scheme-pucked-9.2.12~14^2~90 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=9483cbec86a7c2f1cea262d000e29e91952db318;p=mit-scheme.git Change mime-coded to use regsexp. --- diff --git a/src/runtime/mime-codec.scm b/src/runtime/mime-codec.scm index 61b14035f..eb3c13f6d 100644 --- a/src/runtime/mime-codec.scm +++ b/src/runtime/mime-codec.scm @@ -699,16 +699,22 @@ USA. ((s (string-append (binhex40-decoding-context/line-buffer context) (substring string start end)))) - (let ((regs (re-string-match binhex40-header-regexp s))) - (if regs + (let ((result (regsexp-match-string binhex40-header-regexp s))) + (if result (begin (set-binhex40-decoding-context/state! context 'decoding) (set-binhex40-decoding-context/line-buffer! context #f) - (decode-binhex40:update context s (re-match-end-index 0 regs))) + (decode-binhex40:update context s (cadr result))) (set-binhex40-decoding-context/line-buffer! context s))))) (define binhex40-header-regexp - "[\r\n\t ]*(This file must be converted with BinHex.*[\r\n][\r\n\t ]*:") + (compile-regsexp + '(seq (* (char-set "\r\n\t ")) + "(This file must be converted with BinHex" + (* (any-char)) + (char-set "\r\n") + (* (char-set "\r\n\t ")) + ":"))) (define (decode-binhex40-decoding context string start end) (let ((buffer (binhex40-decoding-context/input-buffer context)))