]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Structured field length bug fix.
authorAdrian Cumiskey <acumiskey@apache.org>
Wed, 19 Nov 2008 11:36:55 +0000 (11:36 +0000)
committerAdrian Cumiskey <acumiskey@apache.org>
Wed, 19 Nov 2008 11:36:55 +0000 (11:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@718933 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java

index 80d7f746f09a2288d40834c152eb0b880b234650..25323b864bcab3eb2df0fe58a4ae1075b1bddfd9 100644 (file)
@@ -47,22 +47,21 @@ public class ObjectAreaDescriptor extends AbstractDescriptor {
         super(width, height, widthRes, heightRes);
     }
 
-    private static final byte oapId = 0x01;
+    private static final byte OBJECT_AREA_POSITION_ID = 0x01;
 
     /** {@inheritDoc} */
     public void writeToStream(OutputStream os) throws IOException {
-        // add triplets
-        addTriplet(new DescriptorPositionTriplet(oapId));
+        byte[] data = new byte[9];
+        copySF(data, Type.DESCRIPTOR, Category.OBJECT_AREA);
+
+        addTriplet(new DescriptorPositionTriplet(OBJECT_AREA_POSITION_ID));
         addTriplet(new MeasurementUnitsTriplet(widthRes, heightRes));
         addTriplet(new ObjectAreaSizeTriplet(width, height));
         addTriplet(new PresentationSpaceResetMixingTriplet(
                 PresentationSpaceResetMixingTriplet.NOT_RESET));
 
-        byte[] data = new byte[9];
-        copySF(data, Type.DESCRIPTOR, Category.OBJECT_AREA);
-
         int tripletDataLength = getTripletDataLength();
-        byte[] len = BinaryUtils.convert(data.length + tripletDataLength, 2);
+        byte[] len = BinaryUtils.convert(data.length + tripletDataLength - 1, 2);
         data[1] = len[0]; // Length
         data[2] = len[1];
         os.write(data);