Author: eweitz Date: Sat May 24 23:35:21 2008 New Revision: 56
Modified: branches/edi/decode.lisp branches/edi/encode.lisp branches/edi/input.lisp branches/edi/strings.lisp Log: Some cosmetic fixes
Passes tests on AllegroCL as well now
Modified: branches/edi/decode.lisp ============================================================================== --- branches/edi/decode.lisp (original) +++ branches/edi/decode.lisp Sat May 24 23:35:21 2008 @@ -1,5 +1,5 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: FLEXI-STREAMS; Base: 10 -*- -;;; $Header: /usr/local/cvsrep/flexi-streams/decode.lisp,v 1.19 2008/05/25 03:07:59 edi Exp $ +;;; $Header: /usr/local/cvsrep/flexi-streams/decode.lisp,v 1.20 2008/05/25 03:25:30 edi Exp $
;;; Copyright (c) 2005-2008, Dr. Edmund Weitz. All rights reserved.
@@ -42,7 +42,7 @@ (defmethod compute-number-of-chars ((format flexi-8-bit-format) sequence start end warnp) (declare #.*fixnum-optimize-settings*) (declare (fixnum start end)) - (declare (ignore sequence)) + (declare (ignore sequence warnp)) (- end start))
(defmethod compute-number-of-chars ((format flexi-crlf-mixin) sequence start end warnp) @@ -51,6 +51,7 @@ ;; below (declare #.*fixnum-optimize-settings*) (declare (fixnum start end)) + (declare (ignore warnp)) (let ((i start) (length (- end start))) (declare (fixnum i length)) @@ -66,8 +67,9 @@
(defgeneric check-end (format start end i warnp) (declare #.*fixnum-optimize-settings*) - (declare (fixnum start end i)) (:method (format start end i warnp) + (declare #.*fixnum-optimize-settings*) + (declare (fixnum start end i)) (when (and warnp (> i end)) (signal-encoding-warning format "These ~A octet~:P can't be ~ decoded using ~A as the sequence is too short. ~A octet~:P missing ~ @@ -76,6 +78,9 @@ (external-format-name format) (- i end)))) (:method ((format flexi-utf-16-format) start end i warnp) + (declare #.*fixnum-optimize-settings*) + (declare (fixnum start end i)) + (declare (ignore i warnp)) ;; don't warn twice (when (evenp (- end start)) (call-next-method)))) @@ -94,7 +99,7 @@ ((= #b11000000 (logand octet #b11100000)) 2) ((= #b11100000 (logand octet #b11110000)) 3) (t 4)))) - (declare (fixnum length) (octet octet)) + (declare (fixnum length) (type octet octet)) (incf sum) (incf i length))) (check-end format start end i warnp) @@ -106,7 +111,7 @@ (let ((sum 0) (i start) (last-octet 0)) - (declare (fixnum i sum) (octet last-octet)) + (declare (fixnum i sum) (type octet last-octet)) (loop (when (>= i end) (return)) @@ -115,7 +120,7 @@ ((= #b11000000 (logand octet #b11100000)) 2) ((= #b11100000 (logand octet #b11110000)) 3) (t 4)))) - (declare (fixnum length) (octet octet)) + (declare (fixnum length) (type octet octet)) (unless (and (= octet +lf+) (= last-octet +cr+)) (incf sum)) (incf i length) @@ -126,6 +131,7 @@ (defmethod compute-number-of-chars :before ((format flexi-utf-16-format) sequence start end warnp) (declare #.*fixnum-optimize-settings*) (declare (fixnum start end)) + (declare (ignore sequence)) (when (and warnp (oddp (- end start))) (signal-encoding-warning format "~A octet~:P cannot be decoded ~ using UTF-16 as ~:*~A is not even." @@ -144,7 +150,7 @@ (let* ((high-octet (aref sequence (1+ i))) (length (cond ((<= #xd8 high-octet #xdf) 4) (t 2)))) - (declare (fixnum length) (octet high-octet)) + (declare (fixnum length) (type octet high-octet)) (incf sum) (incf i length))) (check-end format start (+ end 2) i warnp) @@ -163,7 +169,7 @@ (let* ((high-octet (aref sequence i)) (length (cond ((<= #xd8 high-octet #xdf) 4) (t 2)))) - (declare (fixnum length) (octet high-octet)) + (declare (fixnum length) (type octet high-octet)) (incf sum) (incf i length))) (check-end format start (+ end 2) i warnp) @@ -175,7 +181,7 @@ (let ((sum 0) (i start) (last-octet 0)) - (declare (fixnum i sum) (octet last-octet)) + (declare (fixnum i sum) (type octet last-octet)) (decf end 2) (loop (when (> i end) @@ -183,7 +189,7 @@ (let* ((high-octet (aref sequence (1+ i))) (length (cond ((<= #xd8 high-octet #xdf) 4) (t 2)))) - (declare (fixnum length) (octet high-octet)) + (declare (fixnum length) (type octet high-octet)) (unless (and (zerop high-octet) (= (the octet (aref sequence i)) +lf+) (= last-octet +cr+)) @@ -201,7 +207,7 @@ (let ((sum 0) (i start) (last-octet 0)) - (declare (fixnum i sum) (octet last-octet)) + (declare (fixnum i sum) (type octet last-octet)) (decf end 2) (loop (when (> i end) @@ -209,7 +215,7 @@ (let* ((high-octet (aref sequence i)) (length (cond ((<= #xd8 high-octet #xdf) 4) (t 2)))) - (declare (fixnum length) (octet high-octet)) + (declare (fixnum length) (type octet high-octet)) (unless (and (zerop high-octet) (= (the octet (aref sequence (1+ i))) +lf+) (= last-octet +cr+)) @@ -224,6 +230,7 @@ (defmethod compute-number-of-chars :before ((format flexi-utf-32-format) sequence start end warnp) (declare #.*fixnum-optimize-settings*) (declare (fixnum start end)) + (declare (ignore sequence)) (let ((length (- end start))) (when (and warnp (plusp (mod length 4))) (signal-encoding-warning format "~A octet~:P cannot be decoded ~ @@ -233,12 +240,13 @@ (defmethod compute-number-of-chars ((format flexi-utf-32-format) sequence start end warnp) (declare #.*fixnum-optimize-settings*) (declare (fixnum start end)) - (declare (ignore sequence)) + (declare (ignore sequence warnp)) (ceiling (- end start) 4))
(defmethod compute-number-of-chars ((format flexi-crlf-utf-32-le-format) sequence start end warnp) (declare #.*fixnum-optimize-settings*) (declare (fixnum start end)) + (declare (ignore warnp)) (let ((i start) (length (ceiling (- end start) 4))) (decf end 8) @@ -256,6 +264,7 @@ (defmethod compute-number-of-chars ((format flexi-crlf-utf-32-be-format) sequence start end warnp) (declare #.*fixnum-optimize-settings*) (declare (fixnum start end)) + (declare (ignore warnp)) (let ((i start) (length (ceiling (- end start) 4))) (decf end 8)
Modified: branches/edi/encode.lisp ============================================================================== --- branches/edi/encode.lisp (original) +++ branches/edi/encode.lisp Sat May 24 23:35:21 2008 @@ -1,5 +1,5 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: FLEXI-STREAMS; Base: 10 -*- -;;; $Header: /usr/local/cvsrep/flexi-streams/encode.lisp,v 1.16 2008/05/24 23:27:23 edi Exp $ +;;; $Header: /usr/local/cvsrep/flexi-streams/encode.lisp,v 1.17 2008/05/25 03:25:30 edi Exp $
;;; Copyright (c) 2005-2008, Dr. Edmund Weitz. All rights reserved.
@@ -55,7 +55,7 @@ ((< char-code #x800) 2) ((< char-code #x10000) 3) (t 4)))) - (declare (fixnum char-length) (char-code-integer char-code)) + (declare (fixnum char-length) (type char-code-integer char-code)) (incf sum char-length) (incf i))) sum)) @@ -75,7 +75,7 @@ ((< char-code #x800) 2) ((< char-code #x10000) 3) (t 4)))) - (declare (fixnum char-length) (char-code-integer char-code)) + (declare (fixnum char-length) (type char-code-integer char-code)) (incf sum char-length) (incf i))) sum)) @@ -92,7 +92,7 @@ (let* ((char-code (char-code (aref sequence i))) (char-length (cond ((< char-code #x10000) 2) (t 4)))) - (declare (fixnum char-length) (char-code-integer char-code)) + (declare (fixnum char-length) (type char-code-integer char-code)) (incf sum char-length) (incf i))) sum)) @@ -110,7 +110,7 @@ (char-length (cond ((= char-code #.(char-code #\Newline)) 4) ((< char-code #x10000) 2) (t 4)))) - (declare (fixnum char-length) (char-code-integer char-code)) + (declare (fixnum char-length) (type char-code-integer char-code)) (incf sum char-length) (incf i))) sum)) @@ -128,7 +128,7 @@ (char-length (cond ((= char-code #.(char-code #\Newline)) 4) ((< char-code #x10000) 2) (t 4)))) - (declare (fixnum char-length) (char-code-integer char-code)) + (declare (fixnum char-length) (type char-code-integer char-code)) (incf sum char-length) (incf i))) sum)) @@ -194,7 +194,7 @@ (setq buffer-pos 0)) (write-octet (octet) "Adds one octet to the buffer and flushes it if necessary." - (declare (octet octet)) + (declare (type octet octet)) (when (>= buffer-pos buffer-size) (flush-buffer)) (setf (aref buffer buffer-pos) octet)
Modified: branches/edi/input.lisp ============================================================================== --- branches/edi/input.lisp (original) +++ branches/edi/input.lisp Sat May 24 23:35:21 2008 @@ -1,5 +1,5 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: FLEXI-STREAMS; Base: 10 -*- -;;; $Header: /usr/local/cvsrep/flexi-streams/input.lisp,v 1.76 2008/05/25 03:07:59 edi Exp $ +;;; $Header: /usr/local/cvsrep/flexi-streams/input.lisp,v 1.77 2008/05/25 03:34:55 edi Exp $
;;; Copyright (c) 2005-2008, Dr. Edmund Weitz. All rights reserved.
@@ -150,8 +150,7 @@ (external-format flexi-stream-external-format)) flexi-input-stream (let ((counter 0) octets-reversed) - (declare (integer position) - (fixnum counter)) + (declare (fixnum counter)) (flet ((writer (octet) (incf counter) (push octet octets-reversed)))
Modified: branches/edi/strings.lisp ============================================================================== --- branches/edi/strings.lisp (original) +++ branches/edi/strings.lisp Sat May 24 23:35:21 2008 @@ -1,5 +1,5 @@ ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: FLEXI-STREAMS; Base: 10 -*- -;;; $Header: /usr/local/cvsrep/flexi-streams/strings.lisp,v 1.28 2008/05/25 03:07:59 edi Exp $ +;;; $Header: /usr/local/cvsrep/flexi-streams/strings.lisp,v 1.29 2008/05/25 03:34:55 edi Exp $
;;; Copyright (c) 2005-2008, Dr. Edmund Weitz. All rights reserved.
@@ -69,7 +69,7 @@ (prog1 (nth i sequence) (incf i)))))))) - (declare (fixnum i length) (dynamic-extent reader)) + (declare (fixnum i) (dynamic-extent reader)) (labels ((pseudo-writer (octet) (declare (ignore octet)) (decf i)) @@ -100,6 +100,6 @@ subsequence (of octets) of SEQUENCE from START to END in characters if decoded using the external format EXTERNAL-FORMAT." (declare #.*standard-optimize-settings*) - (declare (fixnum start end) (string string)) + (declare (fixnum start end)) (setq external-format (maybe-convert-external-format external-format)) (compute-number-of-chars external-format sequence start end t))