Skip to content
Snippets Groups Projects
Commit 407ba2b0 authored by rtoy's avatar rtoy
Browse files

In FLUSH-STATE, only flush something if the state has something to be

flushed.
parent 9081ac3d
No related branches found
No related tags found
No related merge requests found
;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: STREAM -*- ;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: STREAM -*-
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
(ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-16.lisp,v 1.12 2010/07/12 14:42:11 rtoy Exp $") (ext:file-comment "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/pcl/simple-streams/external-formats/utf-16.lisp,v 1.13 2010/08/13 01:48:44 rtoy Exp $")
(in-package "STREAM") (in-package "STREAM")
(intl:textdomain "cmucl") (intl:textdomain "cmucl")
...@@ -126,13 +126,14 @@ Unicode replacement character.") ...@@ -126,13 +126,14 @@ Unicode replacement character.")
(,output (ldb (byte 8 8) code)) (,output (ldb (byte 8 8) code))
(,output (ldb (byte 8 0) code)))) (,output (ldb (byte 8 0) code))))
(let ((,c (car ,state))) (let ((,c (car ,state)))
(out (if (lisp::surrogatep ,c) (when ,c
(if ,error (out (if (lisp::surrogatep ,c)
(funcall ,error (if ,error
"Flushing bare surrogate #x~4,'0X is illegal for UTF-16" (funcall ,error
(char-code ,c)) "Flushing bare surrogate #x~4,'0X is illegal for UTF-16"
+replacement-character-code+) (char-code ,c))
,c))))) +replacement-character-code+)
,c))))))
(copy-state (state) (copy-state (state)
;; The state is list. Copy it ;; The state is list. Copy it
`(copy-list ,state))) `(copy-list ,state)))
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