update so _papx stores istd

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Said Ryan Ackley 2003-07-17 03:01:03 +00:00
parent bafcb98f41
commit ab09cd3e82

View File

@ -57,6 +57,7 @@
package org.apache.poi.hwpf.model.hdftypes; package org.apache.poi.hwpf.model.hdftypes;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import org.apache.poi.util.LittleEndian; import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.BitField; import org.apache.poi.util.BitField;
@ -157,8 +158,8 @@ public class StyleDescription implements HDFType
if(x == 0) if(x == 0)
{ {
_istd = LittleEndian.getShort(std, varOffset); _istd = LittleEndian.getShort(std, varOffset);
varOffset += LittleEndian.SHORT_SIZE; //varOffset += LittleEndian.SHORT_SIZE;
int grrprlSize = upxSize - 2; int grrprlSize = upxSize;
_papx = new byte[grrprlSize]; _papx = new byte[grrprlSize];
System.arraycopy(std, varOffset, _papx, 0, grrprlSize); System.arraycopy(std, varOffset, _papx, 0, grrprlSize);
varOffset += grrprlSize; varOffset += grrprlSize;
@ -224,7 +225,7 @@ public class StyleDescription implements HDFType
//only worry about papx and chpx for upxs //only worry about papx and chpx for upxs
if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE) if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE)
{ {
size += _papx.length + 4 + (_papx.length % 2); size += _papx.length + 2 + (_papx.length % 2);
if (_chpx != null) if (_chpx != null)
{ {
size += _chpx.length + 2; size += _chpx.length + 2;
@ -263,9 +264,7 @@ public class StyleDescription implements HDFType
//only worry about papx and chpx for upxs //only worry about papx and chpx for upxs
if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE) if(_styleTypeCode.getValue(_infoShort2) == PARAGRAPH_STYLE)
{ {
LittleEndian.putShort(buf, offset, (short)(_papx.length + 2)); LittleEndian.putShort(buf, offset, (short)(_papx.length));
offset += LittleEndian.SHORT_SIZE;
LittleEndian.putShort(buf, offset, (short)_istd);
offset += LittleEndian.SHORT_SIZE; offset += LittleEndian.SHORT_SIZE;
System.arraycopy(_papx, 0, buf, offset, _papx.length); System.arraycopy(_papx, 0, buf, offset, _papx.length);
offset += _papx.length + (_papx.length % 2); offset += _papx.length + (_papx.length % 2);
@ -297,28 +296,18 @@ public class StyleDescription implements HDFType
sd._infoShort4 == _infoShort4 && sd._infoShort4 == _infoShort4 &&
_name.equals(sd._name)) _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++) return false;
{
if (_chpx[x] != sd._chpx[x])
{
return false;
}
}
return true;
} }
if (_papx != null && _papx.length == sd._papx.length)
if (!Arrays.equals(_papx, sd._papx))
{ {
for (int x = 0; x < _papx.length; x++) return false;
{
if (_papx[x] != sd._papx[x])
{
return false;
}
}
return true;
} }
return true;
} }
return false; return false;
} }