From 407ba2b067b05d0387debb84002f63a6b24e3b7d Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Fri, 13 Aug 2010 01:48:44 +0000 Subject: [PATCH] In FLUSH-STATE, only flush something if the state has something to be flushed. --- pcl/simple-streams/external-formats/utf-16.lisp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pcl/simple-streams/external-formats/utf-16.lisp b/pcl/simple-streams/external-formats/utf-16.lisp index ed69a256f..5e15223d5 100644 --- a/pcl/simple-streams/external-formats/utf-16.lisp +++ b/pcl/simple-streams/external-formats/utf-16.lisp @@ -1,7 +1,7 @@ ;;; -*- 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") (intl:textdomain "cmucl") @@ -126,13 +126,14 @@ Unicode replacement character.") (,output (ldb (byte 8 8) code)) (,output (ldb (byte 8 0) code)))) (let ((,c (car ,state))) - (out (if (lisp::surrogatep ,c) - (if ,error - (funcall ,error - "Flushing bare surrogate #x~4,'0X is illegal for UTF-16" - (char-code ,c)) - +replacement-character-code+) - ,c))))) + (when ,c + (out (if (lisp::surrogatep ,c) + (if ,error + (funcall ,error + "Flushing bare surrogate #x~4,'0X is illegal for UTF-16" + (char-code ,c)) + +replacement-character-code+) + ,c)))))) (copy-state (state) ;; The state is list. Copy it `(copy-list ,state))) -- GitLab