You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by sa...@apache.org on 2003/06/28 17:56:46 UTC
cvs commit: jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes CHPFormattedDiskPage.java PAPFormattedDiskPage.java PropertyNode.java
sackley 2003/06/28 08:56:46
Modified: src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes
CHPFormattedDiskPage.java PAPFormattedDiskPage.java
PropertyNode.java
Log:
latest updates
Revision Changes Path
1.3 +7 -4 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPFormattedDiskPage.java
Index: CHPFormattedDiskPage.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPFormattedDiskPage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CHPFormattedDiskPage.java 24 Jun 2003 11:32:30 -0000 1.2
+++ CHPFormattedDiskPage.java 28 Jun 2003 15:56:46 -0000 1.3
@@ -145,7 +145,7 @@
{
byte[] buf = new byte[512];
int size = _chpxList.size();
- int grpprlOffset = 0;
+ int grpprlOffset = 511;
int offsetOffset = 0;
int fcOffset = 0;
@@ -185,7 +185,7 @@
buf[511] = (byte)index;
offsetOffset = (FC_SIZE * index) + FC_SIZE;
- grpprlOffset = offsetOffset + index + (grpprlOffset % 2);
+ //grpprlOffset = offsetOffset + index + (grpprlOffset % 2);
CHPX chpx = null;
for (int x = 0; x < index; x++)
@@ -194,10 +194,13 @@
byte[] grpprl = chpx.getGrpprl();
LittleEndian.putInt(buf, fcOffset, chpx.getStart() + fcMin);
+ grpprlOffset -= (1 + grpprl.length);
+ grpprlOffset -= (grpprlOffset % 2);
buf[offsetOffset] = (byte)(grpprlOffset/2);
- System.arraycopy(grpprl, 0, buf, grpprlOffset, grpprl.length);
+ buf[grpprlOffset] = (byte)grpprl.length;
+ System.arraycopy(grpprl, 0, buf, grpprlOffset + 1, grpprl.length);
+
- grpprlOffset += grpprl.length + (grpprl.length % 2);
offsetOffset += 1;
fcOffset += FC_SIZE;
}
1.3 +7 -5 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPFormattedDiskPage.java
Index: PAPFormattedDiskPage.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPFormattedDiskPage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PAPFormattedDiskPage.java 24 Jun 2003 11:32:30 -0000 1.2
+++ PAPFormattedDiskPage.java 28 Jun 2003 15:56:46 -0000 1.3
@@ -194,7 +194,7 @@
buf[511] = (byte)index;
bxOffset = (FC_SIZE * index) + FC_SIZE;
- grpprlOffset = bxOffset + (BX_SIZE * index) + (grpprlOffset % 2);
+ grpprlOffset = 511;
PAPX papx = null;
for (int x = 0; x < index; x++)
@@ -203,6 +203,7 @@
byte[] phe = papx.getParagraphHeight().toByteArray();
byte[] grpprl = papx.getGrpprl();
+ grpprlOffset -= (grpprl.length + (2 - grpprl.length % 2));
LittleEndian.putInt(buf, fcOffset, papx.getStart() + fcMin);
buf[bxOffset] = (byte)(grpprlOffset/2);
System.arraycopy(phe, 0, buf, bxOffset + 1, phe.length);
@@ -210,16 +211,17 @@
// refer to the section on PAPX in the spec. Places a size on the front
// of the PAPX. Has to do with how the grpprl stays on word
// boundaries.
+ int copyOffset = grpprlOffset;
if ((grpprl.length % 2) > 0)
{
- buf[grpprlOffset++] = (byte)((grpprl.length + 1)/2);
+ buf[copyOffset++] = (byte)((grpprl.length + 1)/2);
}
else
{
- buf[++grpprlOffset] = (byte)((grpprl.length)/2);
- grpprlOffset++;
+ buf[++copyOffset] = (byte)((grpprl.length)/2);
+ copyOffset++;
}
- System.arraycopy(grpprl, 0, buf, grpprlOffset, grpprl.length);
+ System.arraycopy(grpprl, 0, buf, copyOffset, grpprl.length);
bxOffset += BX_SIZE;
fcOffset += FC_SIZE;
1.3 +22 -0 jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PropertyNode.java
Index: PropertyNode.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PropertyNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PropertyNode.java 24 Jun 2003 11:32:30 -0000 1.2
+++ PropertyNode.java 28 Jun 2003 15:56:46 -0000 1.3
@@ -99,6 +99,28 @@
{
return _buf;
}
+
+ public boolean equals(Object o)
+ {
+ if (((PropertyNode)o).getStart() == _cpStart &&
+ ((PropertyNode)o).getEnd() == _cpEnd)
+ {
+ byte[] testBuf = ((PropertyNode)o).getBuf();
+
+ if (testBuf.length == _buf.length)
+ {
+ for (int x = 0; x < _buf.length; x++)
+ {
+ if (testBuf[x] != _buf[x])
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
/**
* Used for sorting in collections.
*/