Skip to content
Snippets Groups Projects
Commit 013ce69e authored by Kevin M. Rosenberg's avatar Kevin M. Rosenberg
Browse files

r3730: *** empty log message ***

parent 7a201bb1
No related branches found
No related tags found
No related merge requests found
cl-base64 (2.1.0-2) unstable; urgency=low
* Fix broken string-to-base64
-- Kevin M. Rosenberg <kmr@debian.org> Sat, 4 Jan 2003 06:40:32 -0700
cl-base64 (2.0-1) unstable; urgency=low cl-base64 (2.0-1) unstable; urgency=low
* Ignore whitespace in base64 strings * Ignore whitespace in base64 strings
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
;;;; Copyright 2002-2003 Kevin M. Rosenberg ;;;; Copyright 2002-2003 Kevin M. Rosenberg
;;;; Permission to use with BSD-style license included in the COPYING file ;;;; Permission to use with BSD-style license included in the COPYING file
;;;; ;;;;
;;;; $Id: src.lisp,v 1.5 2003/01/04 08:33:13 kevin Exp $ ;;;; $Id: src.lisp,v 1.6 2003/01/04 13:43:27 kevin Exp $
(defpackage #:base64 (defpackage #:base64
(:use #:cl) (:use #:cl)
...@@ -98,8 +98,7 @@ with a #\Newline." ...@@ -98,8 +98,7 @@ with a #\Newline."
(let* ((string-length (length string)) (let* ((string-length (length string))
(complete-group-count (truncate string-length 3)) (complete-group-count (truncate string-length 3))
(remainder (nth-value 1 (truncate string-length 3))) (remainder (nth-value 1 (truncate string-length 3)))
(padded-length (+ remainder (padded-length (* 4 (truncate (+ string-length 2) 3)))
(* 4 complete-group-count)))
(num-lines (if (plusp columns) (num-lines (if (plusp columns)
(truncate (+ padded-length (1- columns)) columns) (truncate (+ padded-length (1- columns)) columns)
0)) 0))
...@@ -148,18 +147,18 @@ with a #\Newline." ...@@ -148,18 +147,18 @@ with a #\Newline."
(the fixnum (the fixnum
(logand #x3f (logand #x3f
(the fixnum (ash svalue -6)))))) (the fixnum (ash svalue -6))))))
(output-char pad)) (output-char pad))
(if (> chars 3) (if (> chars 3)
(output-char (output-char
(schar encode-table (schar encode-table
(the fixnum (the fixnum
(logand #x3f svalue)))) (logand #x3f svalue))))
(output-char pad)))) (output-char pad))))
(do ((igroup 0 (1+ igroup)) (do ((igroup 0 (1+ igroup))
(isource 0 (+ isource 3))) (isource 0 (+ isource 3)))
((= igroup complete-group-count) ((= igroup complete-group-count)
(case remainder (cond
(2 ((= remainder 2)
(output-group (output-group
(the fixnum (the fixnum
(+ (+
...@@ -170,10 +169,10 @@ with a #\Newline." ...@@ -170,10 +169,10 @@ with a #\Newline."
(ash (char-code (the character (ash (char-code (the character
(char string (1+ isource)))) 8)))) (char string (1+ isource)))) 8))))
3)) 3))
(1 ((= remainder 1)
(output-group (output-group
(the fixnum (the fixnum
(char-code (the character (char string isource)))) (ash (char-code (the character (char string isource))) 16))
2))) 2)))
result) result)
(declare (fixnum igroup isource)) (declare (fixnum igroup isource))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment