You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2014/09/27 22:17:26 UTC
svn commit: r1628000 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
Author: tilman
Date: Sat Sep 27 20:17:25 2014
New Revision: 1628000
URL: http://svn.apache.org/r1628000
Log:
PDFBOX-2376: improve recognition of token after EI
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java?rev=1628000&r1=1627999&r2=1628000&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java Sat Sep 27 20:17:25 2014
@@ -466,34 +466,31 @@ public class PDFStreamParser extends Bas
for (int bIdx = 0; bIdx < readBytes; bIdx++)
{
final byte b = binCharTestArr[bIdx];
- if ((b < 0x09) || ((b > 0x0a) && (b < 0x20) && (b != 0x0d)))
+ if (b < 0x09 || b > 0x0a && b < 0x20 && b != 0x0d)
{
// control character or > 0x7f -> we have binary data
noBinData = false;
break;
}
// find the start of a PDF operator
- if (startOpIdx == -1 && (b == 9 || b == 0x20 || b == 0x0a || b == 0x0d))
+ if (startOpIdx == -1 && !(b == 9 || b == 0x20 || b == 0x0a || b == 0x0d))
{
startOpIdx = bIdx;
}
- else if (startOpIdx != -1 && endOpIdx == -1 && (b == 9 || b == 0x20 || b == 0x0a || b == 0x0d))
+ else if (startOpIdx != -1 && endOpIdx == -1 &&
+ (b == 9 || b == 0x20 || b == 0x0a || b == 0x0d))
{
- if (bIdx == startOpIdx + 1)
- {
- // several blanks after another
- startOpIdx = bIdx;
- }
- else
- {
- endOpIdx = bIdx;
- }
+ endOpIdx = bIdx;
}
}
if (readBytes == maxBinCharTestLength) // only if not close to eof
{
// a PDF operator is 1-3 bytes long
- if (endOpIdx == -1 || startOpIdx == -1 || endOpIdx - startOpIdx > 3)
+ if (startOpIdx != -1 && endOpIdx == -1)
+ {
+ endOpIdx = maxBinCharTestLength;
+ }
+ if (endOpIdx != -1 && startOpIdx != -1 && endOpIdx - startOpIdx > 3)
{
noBinData = false;
}