pietsch 2002/08/01 07:52:49
Modified: src/org/apache/fop/pdf Tag: fop-0_20_2-maintain
ASCII85Filter.java
Log:
Simplified ASCII85Filter computation, thereby hopefully
working around JVM bugs
Revision Changes Path
No revision
No revision
1.3.2.2 +30 -18 xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java
Index: ASCII85Filter.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -r1.3.2.1 -r1.3.2.2
--- ASCII85Filter.java 31 May 2002 00:17:16 -0000 1.3.2.1
+++ ASCII85Filter.java 1 Aug 2002 14:52:49 -0000 1.3.2.2
@@ -17,9 +17,9 @@
private static final String ASCII85_EOD = "~>";
private static final long base85_4 = 85;
- private static final long base85_3 = base85_4 * base85_4;
- private static final long base85_2 = base85_3 * base85_4;
- private static final long base85_1 = base85_2 * base85_4;
+// private static final long base85_3 = base85_4 * base85_4;
+// private static final long base85_2 = base85_3 * base85_4;
+// private static final long base85_1 = base85_2 * base85_4;
@@ -131,22 +131,34 @@
};
return result;
} else {
- byte c1 = (byte)((word / base85_1) & 0xFF);
- byte c2 = (byte)(((word - (c1 * base85_1)) / base85_2) & 0xFF);
- byte c3 =
- (byte)(((word - (c1 * base85_1) - (c2 * base85_2)) / base85_3)
- & 0xFF);
- byte c4 =
- (byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 *
base85_3)) / base85_4)
- & 0xFF);
- byte c5 =
- (byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 * base85_3)
- (c4 * base85_4)))
- & 0xFF);
+// byte c1 = (byte)((word / base85_1) & 0xFF);
+// byte c2 = (byte)(((word - (c1 * base85_1)) / base85_2) & 0xFF);
+// byte c3 =
+// (byte)(((word - (c1 * base85_1) - (c2 * base85_2)) / base85_3)
+// & 0xFF);
+// byte c4 =
+// (byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 *
base85_3)) / base85_4)
+// & 0xFF);
+// byte c5 =
+// (byte)(((word - (c1 * base85_1) - (c2 * base85_2) - (c3 *
base85_3) - (c4 * base85_4)))
+// & 0xFF);
+
+// byte[] ret = {
+// (byte)(c1 + ASCII85_START), (byte)(c2 + ASCII85_START),
+// (byte)(c3 + ASCII85_START), (byte)(c4 + ASCII85_START),
+// (byte)(c5 + ASCII85_START)
+ byte c5 = (byte)((word % base85_4) + ASCII85_START);
+ word = word / base85_4;
+ byte c4 = (byte)((word % base85_4) + ASCII85_START);
+ word = word / base85_4;
+ byte c3 = (byte)((word % base85_4) + ASCII85_START);
+ word = word / base85_4;
+ byte c2 = (byte)((word % base85_4) + ASCII85_START);
+ word = word / base85_4;
+ byte c1 = (byte)((word % base85_4) + ASCII85_START);
byte[] ret = {
- (byte)(c1 + ASCII85_START), (byte)(c2 + ASCII85_START),
- (byte)(c3 + ASCII85_START), (byte)(c4 + ASCII85_START),
- (byte)(c5 + ASCII85_START)
+ c1 , c2, c3, c4, c5
};
for (int i = 0; i < ret.length; i++) {
if (ret[i] < 33 || ret[i] > 117) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]