From: Said Ryan Ackley Date: Thu, 17 Jul 2003 03:01:03 +0000 (+0000) Subject: update so _papx stores istd X-Git-Tag: PERF_BEFORE_MERGE~256 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dc048aa8a1738250b3cd2924a71f1c21d7f86e5b;p=poi.git update so _papx stores istd git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353218 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/StyleDescription.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/StyleDescription.java index a55c33a65b..c8f0976b8f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/StyleDescription.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/StyleDescription.java @@ -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 @@ public class StyleDescription implements HDFType 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 @@ public class StyleDescription implements HDFType //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 @@ public class StyleDescription implements HDFType //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 @@ public class StyleDescription implements HDFType 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; }