sackley     2003/07/16 20:01:03

  Modified:    src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes
                        StyleDescription.java
  Log:
  update so _papx stores istd
  
  Revision  Changes    Path
  1.5       +13 -24    
jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/StyleDescription.java
  
  Index: StyleDescription.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/StyleDescription.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StyleDescription.java     15 Jul 2003 03:22:53 -0000      1.4
  +++ StyleDescription.java     17 Jul 2003 03:01:03 -0000      1.5
  @@ -57,6 +57,7 @@
   package org.apache.poi.hwpf.model.hdftypes;
   
   import java.io.UnsupportedEncodingException;
  +import java.util.Arrays;
   
   import org.apache.poi.util.LittleEndian;
   import org.apache.poi.util.BitField;
  @@ -157,8 +158,8 @@
                 if(x == 0)
                 {
                     _istd = LittleEndian.getShort(std, varOffset);
  -                  varOffset += LittleEndian.SHORT_SIZE;
  -                  int grrprlSize = upxSize - 2;
  +                  //varOffset += LittleEndian.SHORT_SIZE;
  +                  int grrprlSize = upxSize;
                     _papx = new byte[grrprlSize];
                     System.arraycopy(std, varOffset, _papx, 0, grrprlSize);
                     varOffset += grrprlSize;
  @@ -224,7 +225,7 @@
       //only worry about papx and chpx for upxs
       if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE)
       {
  -      size += _papx.length + 4 + (_papx.length % 2);
  +      size += _papx.length + 2 + (_papx.length % 2);
         if (_chpx != null)
         {
           size += _chpx.length + 2;
  @@ -263,9 +264,7 @@
       //only worry about papx and chpx for upxs
       if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE)
       {
  -      LittleEndian.putShort(buf, offset, (short)(_papx.length + 2));
  -      offset += LittleEndian.SHORT_SIZE;
  -      LittleEndian.putShort(buf, offset, (short)_istd);
  +      LittleEndian.putShort(buf, offset, (short)(_papx.length));
         offset += LittleEndian.SHORT_SIZE;
         System.arraycopy(_papx, 0, buf, offset, _papx.length);
         offset += _papx.length + (_papx.length % 2);
  @@ -297,28 +296,18 @@
           sd._infoShort4 == _infoShort4 &&
           _name.equals(sd._name))
       {
  -      if (_chpx != null && _chpx.length == sd._chpx.length)
  +
  +      if (!Arrays.equals(_chpx, sd._chpx))
         {
  -        for (int x = 0; x < _chpx.length; x++)
  -        {
  -          if (_chpx[x] != sd._chpx[x])
  -          {
  -            return false;
  -          }
  -        }
  -        return true;
  +        return false;
         }
  -      if (_papx != null && _papx.length == sd._papx.length)
  +
  +      if (!Arrays.equals(_papx, sd._papx))
         {
  -        for (int x = 0; x < _papx.length; x++)
  -        {
  -          if (_papx[x] != sd._papx[x])
  -          {
  -            return false;
  -          }
  -        }
  -        return true;
  +        return false;
         }
  +
  +      return true;
       }
       return false;
     }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to