From 3bf5dbcb14bf9c5a1f4d2d3746a3fb0fa6232937 Mon Sep 17 00:00:00 2001 From: Adrian Cumiskey Date: Wed, 19 Nov 2008 11:36:55 +0000 Subject: [PATCH] Structured field length bug fix. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@718933 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/afp/modca/ObjectAreaDescriptor.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java b/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java index 80d7f746f..25323b864 100644 --- a/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java +++ b/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java @@ -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); -- 2.39.5