Author: lehmi
Date: Thu Jan 5 06:23:44 2012
New Revision: 1227500
URL: http://svn.apache.org/viewvc?rev=1227500&view=rev
Log:
PDFBOX-1196: use long instead of int for object offsets as proposed by Timo
Boehme
Modified:
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/StreamValidationHelper.java
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/TrailerValidationHelper.java
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/utils/TestCOSUtils.java
Modified:
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/StreamValidationHelper.java
URL:
http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/StreamValidationHelper.java?rev=1227500&r1=1227499&r2=1227500&view=diff
==============================================================================
---
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/StreamValidationHelper.java
(original)
+++
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/StreamValidationHelper.java
Thu Jan 5 06:23:44 2012
@@ -215,7 +215,7 @@ public class StreamValidationHelper exte
InputStream ra = null;
try {
ra = handler.getSource().getInputStream();
- Integer offset = (Integer)
handler.getDocument().getDocument()
+ Long offset = handler.getDocument().getDocument()
.getXrefTable().get(new
COSObjectKey(cObj));
// ---- go to the beginning of the object
Modified:
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/TrailerValidationHelper.java
URL:
http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/TrailerValidationHelper.java?rev=1227500&r1=1227499&r2=1227500&view=diff
==============================================================================
---
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/TrailerValidationHelper.java
(original)
+++
pdfbox/trunk/preflight/src/main/java/org/apache/padaf/preflight/helpers/TrailerValidationHelper.java
Thu Jan 5 06:23:44 2012
@@ -158,14 +158,14 @@ public class TrailerValidationHelper ext
} else {
- int min = Integer.MAX_VALUE;
- int max = Integer.MIN_VALUE;
+ long min = Long.MAX_VALUE;
+ long max = Long.MIN_VALUE;
COSDictionary firstTrailer = null;
COSDictionary lastTrailer = null;
// Search First and Last trailers according to
offset position.
for(COSObject co : xrefs) {
- int offset =
cosDocument.getXrefTable().get(new COSObjectKey(co));
+ long offset =
cosDocument.getXrefTable().get(new COSObjectKey(co));
if (offset < min) {
min = offset;
firstTrailer =
(COSDictionary)co.getObject();
Modified:
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/utils/TestCOSUtils.java
URL:
http://svn.apache.org/viewvc/pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/utils/TestCOSUtils.java?rev=1227500&r1=1227499&r2=1227500&view=diff
==============================================================================
---
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/utils/TestCOSUtils.java
(original)
+++
pdfbox/trunk/preflight/src/test/java/org/apache/padaf/preflight/utils/TestCOSUtils.java
Thu Jan 5 06:23:44 2012
@@ -50,7 +50,7 @@ public class TestCOSUtils {
public void testIsInteger() {
try {
COSObject co = new COSObject(new COSInteger(10));
- co.setGenerationNumber(new COSInteger(0));
+ co.setGenerationNumber(COSInteger.ZERO);
co.setObjectNumber(new COSInteger(10));
assertFalse(COSUtils.isInteger(co, new IOCOSDocument()));
@@ -68,7 +68,7 @@ public class TestCOSUtils {
public void testIsFloat() {
try {
COSObject co = new COSObject(new COSFloat(10.0f));
- co.setGenerationNumber(new COSInteger(0));
+ co.setGenerationNumber(COSInteger.ZERO);
co.setObjectNumber(new COSInteger(10));
assertFalse(COSUtils.isFloat(co, new IOCOSDocument()));
@@ -86,7 +86,7 @@ public class TestCOSUtils {
public void testIsString() {
try {
COSObject co = new COSObject(new COSString(""));
- co.setGenerationNumber(new COSInteger(0));
+ co.setGenerationNumber(COSInteger.ZERO);
co.setObjectNumber(new COSInteger(10));
assertFalse(COSUtils.isString(co, new IOCOSDocument()));
@@ -104,7 +104,7 @@ public class TestCOSUtils {
public void testIsStream() {
try {
COSObject co = new COSObject(new COSStream(null));
- co.setGenerationNumber(new COSInteger(0));
+ co.setGenerationNumber(COSInteger.ZERO);
co.setObjectNumber(new COSInteger(10));
assertFalse(COSUtils.isStream(co, new IOCOSDocument()));
@@ -122,7 +122,7 @@ public class TestCOSUtils {
public void testIsDictionary() {
try {
COSObject co = new COSObject(new COSDictionary());
- co.setGenerationNumber(new COSInteger(0));
+ co.setGenerationNumber(COSInteger.ZERO);
co.setObjectNumber(new COSInteger(10));
assertFalse(COSUtils.isDictionary(co, new IOCOSDocument()));
@@ -140,7 +140,7 @@ public class TestCOSUtils {
public void testIsArray() {
try {
COSObject co = new COSObject(new COSArray());
- co.setGenerationNumber(new COSInteger(0));
+ co.setGenerationNumber(COSInteger.ZERO);
co.setObjectNumber(new COSInteger(10));
assertFalse(COSUtils.isArray(co, new IOCOSDocument()));
@@ -173,8 +173,8 @@ public class TestCOSUtils {
}
}
- protected void addToXref( COSDocument doc, COSObjectKey key, int value) {
- Map<COSObjectKey, Integer> xrefTable = new HashMap<COSObjectKey,
Integer>(1);
+ protected void addToXref( COSDocument doc, COSObjectKey key, long value) {
+ Map<COSObjectKey, Long> xrefTable = new HashMap<COSObjectKey, Long>(1);
xrefTable.put(key, value);
doc.addXRefTable(xrefTable);
}