[armedbear-cvs] r11411 - branches/open-external-format/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Wed Dec 3 21:35:51 UTC 2008


Author: ehuelsmann
Date: Wed Dec  3 21:35:51 2008
New Revision: 11411

Log:
Fix eol-style initialization and double-output.

Modified:
   branches/open-external-format/src/org/armedbear/lisp/Stream.java

Modified: branches/open-external-format/src/org/armedbear/lisp/Stream.java
==============================================================================
--- branches/open-external-format/src/org/armedbear/lisp/Stream.java	(original)
+++ branches/open-external-format/src/org/armedbear/lisp/Stream.java	Wed Dec  3 21:35:51 2008
@@ -101,7 +101,7 @@
   public final static EolStyle platformEolStyle = Utilities.isPlatformWindows ? EolStyle.CRLF : EolStyle.LF;
     
   protected EolStyle eolStyle = platformEolStyle;
-  protected char eolChar = 0;
+  protected char eolChar = (eolStyle == EolStyle.CR) ? '\r' : '\n';
   protected LispObject externalFormat = LispObject.NIL;
   protected String encoding = null;
   
@@ -1883,13 +1883,14 @@
     try
       {
         if (eolStyle != EolStyle.RAW) {
-          for (int i = start; i++ < end;)
+          for (int i = start; i < end; i++)
             //###FIXME: the number of writes can be greatly reduced by
             // writing the space between newlines as chunks.
             _writeChar(chars[i]);
-        }
+          
+        } else
+          writer.write(chars, start, end - start);
         
-        writer.write(chars, start, end - start);
         int index = -1;
         for (int i = end; i-- > start;)
           {




More information about the armedbear-cvs mailing list