poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acoli...@apache.org
Subject cvs commit: jakarta-poi/src/java/org/apache/poi/hssf/record RecordFactory.java
Date Thu, 28 Nov 2002 19:20:36 GMT
acoliver    2002/11/28 11:20:36

  Modified:    src/java/org/apache/poi/hssf/model Workbook.java
               src/java/org/apache/poi/hssf/record RecordFactory.java
  Log:
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13500
  
  Revision  Changes    Path
  1.20      +16 -5     jakarta-poi/src/java/org/apache/poi/hssf/model/Workbook.java
  
  Index: Workbook.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/model/Workbook.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Workbook.java	23 Nov 2002 18:58:52 -0000	1.19
  +++ Workbook.java	28 Nov 2002 19:20:35 -0000	1.20
  @@ -88,6 +88,7 @@
    * @author  Andrew C. Oliver (acoliver at apache dot org)
    * @author  Glen Stampoultzis (glens at apache.org)
    * @author  Sergei Kozello (sergeikozello at mail.ru)
  + * @author  Luc Girardin (luc dot girardin at macrofocus dot com)
    * @see org.apache.poi.hssf.usermodel.HSSFWorkbook
    * @version 1.0-pre
    */
  @@ -670,8 +671,11 @@
   
               // byte[] rec = (( byte [] ) bytes.get(k));
               // System.arraycopy(rec, 0, retval, pos, rec.length);
  -            pos += (( Record ) records.get(k)).serialize(pos,
  -            retval);   // rec.length;
  +            Record record = (( Record ) records.get(k));
  +            // Let's skip RECALCID records, as they are only use for optimization
  +            if(record.getSid() != RecalcIdRecord.sid || ((RecalcIdRecord)record).isNeeded())
{
  +               pos += record.serialize(pos, retval);   // rec.length;
  +            }
           }
           log.log(DEBUG, "Exiting serialize workbook");
           return retval;
  @@ -704,8 +708,11 @@
   
               // byte[] rec = (( byte [] ) bytes.get(k));
               // System.arraycopy(rec, 0, data, offset + pos, rec.length);
  -            pos += (( Record ) records.get(k)).serialize(pos + offset,
  -            data);   // rec.length;
  +            Record record = (( Record ) records.get(k));
  +            // Let's skip RECALCID records, as they are only use for optimization
  +            if(record.getSid() != RecalcIdRecord.sid || ((RecalcIdRecord)record).isNeeded())
{
  +               pos += record.serialize(pos + offset, data);   // rec.length;
  +            }
           }
           log.log(DEBUG, "Exiting serialize workbook");
           return pos;
  @@ -715,7 +722,11 @@
           int retval = 0;
   
           for (int k = 0; k < records.size(); k++) {
  -            retval += (( Record ) records.get(k)).getRecordSize();
  +            Record record = (( Record ) records.get(k));
  +            // Let's skip RECALCID records, as they are only use for optimization
  +            if(record.getSid() != RecalcIdRecord.sid || ((RecalcIdRecord)record).isNeeded())
{
  +               retval += record.getRecordSize();
  +            }
           }
           return retval;
       }
  
  
  
  1.13      +2 -2      jakarta-poi/src/java/org/apache/poi/hssf/record/RecordFactory.java
  
  Index: RecordFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/record/RecordFactory.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- RecordFactory.java	11 Nov 2002 01:34:01 -0000	1.12
  +++ RecordFactory.java	28 Nov 2002 19:20:36 -0000	1.13
  @@ -111,7 +111,7 @@
                   FormulaRecord.class, BoolErrRecord.class, ExternSheetRecord.class,
                   NameRecord.class, LeftMarginRecord.class, RightMarginRecord.class,
                   TopMarginRecord.class, BottomMarginRecord.class,
  -                PaletteRecord.class, StringRecord.class
  +                PaletteRecord.class, StringRecord.class, RecalcIdRecord.class
               };
           } else {
               records = new Class[]
  @@ -142,7 +142,7 @@
                   BoolErrRecord.class, ExternSheetRecord.class, NameRecord.class,
                   LeftMarginRecord.class, RightMarginRecord.class,
                   TopMarginRecord.class, BottomMarginRecord.class,
  -                PaletteRecord.class, StringRecord.class
  +                PaletteRecord.class, StringRecord.class, RecalcIdRecord.class
               };
   
           }
  
  
  

Mime
View raw message