Changeset 8918


Ignore:
Timestamp:
04/11/05 14:07:23 (16 years ago)
Author:
piso
Message:

Writer.write(): call string.ensureCapacity().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/FillPointerOutputStream.java

    r8198 r8918  
    22 * FillPointerOutputStream.java
    33 *
    4  * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: FillPointerOutputStream.java,v 1.12 2004-11-28 15:43:49 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: FillPointerOutputStream.java,v 1.13 2005-04-11 14:07:23 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5959            int fp = string.getFillPointer();
    6060            if (fp >= 0) {
    61                 final int capacity = string.capacity();
    6261                final int limit = Math.min(cbuf.length, off + len);
    63                 for (int i = off; i < limit && fp < capacity; i++) {
     62                try {
     63                    string.ensureCapacity(fp + limit);
     64                }
     65                catch (ConditionThrowable t) {
     66                    // Shouldn't happen.
     67                    Debug.trace(t);
     68                }
     69                for (int i = off; i < limit; i++) {
    6470                    try {
    6571                        string.setCharAt(fp, cbuf[i]);
Note: See TracChangeset for help on using the changeset viewer.