From 9483cbec86a7c2f1cea262d000e29e91952db318 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 3 May 2017 00:17:18 -0700 Subject: [PATCH] Change mime-coded to use regsexp. --- src/runtime/mime-codec.scm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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))) -- 2.25.1