From cbe4472093e0577b98dad70e6b1f214d12e53366 Mon Sep 17 00:00:00 2001 From: morioka Date: Sat, 20 Jun 1998 11:33:46 +0000 Subject: [PATCH] (quoted-printable-hex-char-to-num): New function. (quoted-printable-decode-string): Use `quoted-printable-hex-char-to-num'. --- mel-q.el | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/mel-q.el b/mel-q.el index 130865e..dc6faee 100644 --- a/mel-q.el +++ b/mel-q.el @@ -158,6 +158,12 @@ It calls external quoted-printable encoder specified by ;;; @ Quoted-Printable decoder ;;; +(defsubst quoted-printable-hex-char-to-num (chr) + (cond ((<= ?a chr) (+ (- chr ?a) 10)) + ((<= ?A chr) (+ (- chr ?A) 10)) + ((<= ?0 chr) (- chr ?0)) + )) + (defun quoted-printable-decode-string (string) "Decode STRING which is encoded in quoted-printable, and return the result." (let (q h l) @@ -166,17 +172,10 @@ It calls external quoted-printable encoder specified by (cond ((eq chr ?=) (setq q t) "") - (q (setq h - (cond ((<= ?a chr) (+ (- chr ?a) 10)) - ((<= ?A chr) (+ (- chr ?A) 10)) - ((<= ?0 chr) (- chr ?0)) - )) + (q (setq h (quoted-printable-hex-char-to-num chr)) (setq q nil) "") - (h (setq l (cond ((<= ?a chr) (+ (- chr ?a) 10)) - ((<= ?A chr) (+ (- chr ?A) 10)) - ((<= ?0 chr) (- chr ?0)) - )) + (h (setq l (quoted-printable-hex-char-to-num chr)) (prog1 (char-to-string (logior (ash h 4) l)) (setq h nil) -- 1.7.10.4