summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2018-09-12 16:06:24 +0530
committerArun Isaac2018-09-12 16:06:24 +0530
commitdc63650fc9a1617933d7076961a52408ba0d54fd (patch)
tree9c73c3621e72ef38774f3b93d007025be4f7b05d
parentbfed089d9973b1208f2b0e67dc457f3a6bcddd28 (diff)
downloadguile-email-dc63650fc9a1617933d7076961a52408ba0d54fd.tar.gz
guile-email-dc63650fc9a1617933d7076961a52408ba0d54fd.tar.lz
guile-email-dc63650fc9a1617933d7076961a52408ba0d54fd.zip
quoted-printable: Close port after use.
* email/quoted-printable.scm (quoted-printable-decode): Close bytevector port after use. In cond, use else instead of #t for the default clause.
-rw-r--r--email/quoted-printable.scm15
1 files changed, 8 insertions, 7 deletions
diff --git a/email/quoted-printable.scm b/email/quoted-printable.scm
index f6e3605..317bf81 100644
--- a/email/quoted-printable.scm
+++ b/email/quoted-printable.scm
@@ -31,13 +31,14 @@
(((? port? in))
(let-values (((out get-bytevector)
(open-bytevector-output-port)))
- (quoted-printable-decode in out)
- (get-bytevector)))
+ (call-with-port
+ out (lambda (out)
+ (quoted-printable-decode in out)
+ (get-bytevector)))))
(((? port? in) (? port? out))
(let ((c (read-char in)))
(cond
- ((eof-object? c)
- out)
+ ((eof-object? c) out)
((char=? c #\=)
;; TODO: Support "\r\n" line ending
(let ((c1 (read-char in)))
@@ -45,9 +46,9 @@
(let ((c2 (read-char in)))
(put-u8 out (string->number (string c1 c2) 16)))))
(quoted-printable-decode in out))
- (#t
- (put-u8 out (char->integer c))
- (quoted-printable-decode in out)))))))
+ (else (put-u8 out (char->integer c))
+ (quoted-printable-decode in out)))))))
+
(define (q-encoding-decode str)
(quoted-printable-decode