Mark VandenBrink 12 anni fa
parent
commit
be966f9b8a
2 ha cambiato i file con 9 aggiunte e 16 eliminazioni
  1. 9 15
      audio-streams.lisp
  2. 0 1
      taglib-tests.lisp

+ 9 - 15
audio-streams.lisp

@@ -157,9 +157,7 @@ a displaced array from STREAMs underlying vector.  If it is == 7, then we have t
 ;;; Decode octets as an iso-8859-1 string (encoding == 0)
 (defun stream-decode-iso-string (octets &key (start 0) (end (length octets)))
   (declare #.utils:*standard-optimize-settings*)
-  #+CCL (ccl:decode-string-from-octets octets :start start :end end :external-format :iso-8859-1)
-  #-CCL (flexi-streams:octets-to-string octets :start start :end end :external-format :iso-8859-1)
-  )
+  (flexi-streams:octets-to-string octets :start start :end end :external-format :iso-8859-1))
 
 ;;;
 ;;; XXX: Coded this way because I can't seem to get a simple :external-format :ucs-2 to work correctly
@@ -182,29 +180,25 @@ a displaced array from STREAMs underlying vector.  If it is == 7, then we have t
           (t
            ;;
            ;; else, we have a (hopefully) properly encoded string
+           (when (oddp end)
+             (warn-user "Malformed UCS string, length (~d) is odd---fixing by decrementing by 1" end)
+             (setf end (1- end)))
+
            (let ((bom (get-byte-order-mark octets)))
              (ecase (the fixnum bom)
-               (#xfffe #+CCL (ccl:decode-string-from-octets octets :start (+ 2 start) :end end :external-format :ucs-2le)
-                       #-CCL (flexi-streams:octets-to-string octets :start (+ 2 start) :end end :external-format :ucs-2le)
-                       )
-               (#xfeff #+CCL (ccl:decode-string-from-octets octets :start (+ 2 start) :end end :external-format :ucs-2be)
-                       #-CCL (flexi-streams:octets-to-string octets :start (+ 2 start) :end end :external-format :ucs-2be)
-                       )
+               (#xfffe (flexi-streams:octets-to-string octets :start (+ 2 start) :end end :external-format :ucs-2le))
+               (#xfeff (flexi-streams:octets-to-string octets :start (+ 2 start) :end end :external-format :ucs-2be))
                (0      (make-string 0))))))))
 
 (defun stream-decode-ucs-be-string (octets &key (start 0) (end (length octets)))
   "Decode octets as a UCS-BE string (encoding == 2)"
   (declare #.utils:*standard-optimize-settings*)
-  #+CCL (ccl:decode-string-from-octets octets :start start :end end :external-format :ucs-2be)
-  #-CCL (flexi-streams:octets-to-string octets :start start :end end :external-format :ucs-2be)
-  )
+  (flexi-streams:octets-to-string octets :start start :end end :external-format :ucs-2be))
 
 (defun stream-decode-utf-8-string (octets &key (start 0) (end (length octets)))
   "Decode octets as a utf-8 string"
   (declare #.utils:*standard-optimize-settings*)
-  #+CCL (ccl:decode-string-from-octets octets :start start :end end :external-format :utf-8)
-  #-CCL (flexi-streams:octets-to-string octets :start start :end end :external-format :utf-8)
-  )
+  (flexi-streams:octets-to-string octets :start start :end end :external-format :utf-8))
 
 (defun stream-decode-string (octets &key (start 0) (end (length octets)) (encoding 0))
   "Decode octets depending on encoding"

+ 0 - 1
taglib-tests.lisp

@@ -48,7 +48,6 @@
         (flac-count 0)
         (mp4-count 0)
         (other-count 0))
-
     (cl-fad:walk-directory dir (lambda (f)
                                  (do-audio-file f :func (lambda (s)
                                                           (cond ((typep s 'mp3-file-stream)  (incf mp3-count))