You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2015/03/17 13:28:08 UTC
svn commit: r1667287 - in
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox: cos/ filter/ccitt/
pdfparser/ pdmodel/common/function/
pdmodel/interactive/digitalsignature/visible/
Author: msahyoun
Date: Tue Mar 17 12:28:08 2015
New Revision: 1667287
URL: http://svn.apache.org/r1667287
Log:
PDFBOX-2712 remove commented out lines
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/CCITTFaxG31DDecodeInputStream.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java?rev=1667287&r1=1667286&r2=1667287&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java Tue Mar 17 12:28:08 2015
@@ -225,23 +225,8 @@ public class COSStream extends COSDictio
}
else
{
- // We should check if the COSStream contains data, maybe it
- // has been created with a RandomAccessFile - which is not
- // necessary empty.
- // In this case, the creation was been done as an input, this should
- // be the unfiltered file, since no filter has been applied yet.
-// if ( (file != null) &&
-// (file.length() > 0) )
-// {
-// retval = new RandomAccessFileInputStream( file,
-// 0,
-// file.length() );
-// }
-// else
-// {
- //if there is no stream data then simply return an empty stream.
- retval = new ByteArrayInputStream( new byte[0] );
-// }
+
+ retval = new ByteArrayInputStream( new byte[0] );
}
return retval;
}
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/CCITTFaxG31DDecodeInputStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/CCITTFaxG31DDecodeInputStream.java?rev=1667287&r1=1667286&r2=1667287&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/CCITTFaxG31DDecodeInputStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/filter/ccitt/CCITTFaxG31DDecodeInputStream.java Tue Mar 17 12:28:08 2015
@@ -109,7 +109,6 @@ public final class CCITTFaxG31DDecodeInp
}
byte data = this.decodedLine.getData()[this.decodedReadPos++];
- //System.out.println("Returning " + PackedBitArray.visualizeByte(data));
return data & 0xFF;
}
@@ -123,14 +122,15 @@ public final class CCITTFaxG31DDecodeInp
}
if (this.bits < 0)
{
- return false; //Shortcut after EOD
+ //Shortcut after EOD
+ return false;
}
this.y++;
- //System.out.println("decodeLine " + this.y);
int x = 0;
if (this.rows > 0 && this.y >= this.rows)
{
- return false; //All rows decoded, ignore further bits
+ //All rows decoded, ignore further bits
+ return false;
}
this.decodedLine.clear();
this.decodedWritePos = 0;
@@ -160,13 +160,13 @@ public final class CCITTFaxG31DDecodeInp
expectRTC--;
if (expectRTC == 0)
{
- //System.out.println("Return to Control");
- return false; //Return to Control = End Of Data
+ //Return to Control = End Of Data
+ return false;
}
if (x == 0)
{
- //System.out.println("Ignoring leading EOL");
- continue; //Ignore leading EOL
+ //Ignore leading EOL
+ continue;
}
}
else
@@ -188,7 +188,6 @@ public final class CCITTFaxG31DDecodeInp
{
this.accumulatedRunLength += length;
- //System.out.println(" Run " + bit + " for " + this.accumulatedRunLength + " at " + decodedWritePos);
if (bit != 0)
{
this.decodedLine.setBits(this.decodedWritePos, this.accumulatedRunLength);
@@ -199,7 +198,6 @@ public final class CCITTFaxG31DDecodeInp
private void writeNonTerminating(int length)
{
- //System.out.println(" Make up code for " + length + " bits");
this.accumulatedRunLength += length;
}
@@ -217,7 +215,6 @@ public final class CCITTFaxG31DDecodeInp
}
}
final int bit = (this.bits & BIT_POS_MASKS[this.bitPos++]) == 0 ? 0 : 1;
- //System.out.print(bit);
return bit;
}
@@ -440,7 +437,8 @@ public final class CCITTFaxG31DDecodeInp
do
{
bit = decoder.readBit();
- } while (bit == 0); //bit 1 finishes the EOL, any number of bit 0 allowed as fillers
+ //bit 1 finishes the EOL, any number of bit 0 allowed as fillers
+ } while (bit == 0);
if (bit < 0)
{
return null;
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java?rev=1667287&r1=1667286&r2=1667287&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java Tue Mar 17 12:28:08 2015
@@ -410,9 +410,8 @@ public abstract class BaseParser impleme
pdfSource.unread( whitespace );
}
- /*This needs to be dic.getItem because when we are parsing, the underlying object
- * might still be null.
- */
+ // This needs to be dic.getItem because when we are parsing, the underlying object
+ // might still be null.
COSBase streamLength = dic.getItem(COSName.LENGTH);
//Need to keep track of the
@@ -579,7 +578,8 @@ public abstract class BaseParser impleme
int charMatchCount = 0;
byte[] keyw = ENDSTREAM;
- final int quickTestOffset = 5; // last character position of shortest keyword ('endobj')
+ // last character position of shortest keyword ('endobj')
+ final int quickTestOffset = 5;
// read next chunk into buffer; already matched chars are added to beginning of buffer
while ( ( bufSize = pdfSource.read( strmBuf, charMatchCount, STRMBUFLEN - charMatchCount ) ) > 0 )
@@ -611,7 +611,8 @@ public abstract class BaseParser impleme
}
}
- final byte ch = strmBuf[bIdx]; // could be negative - but we only compare to ASCII
+ // could be negative - but we only compare to ASCII
+ final byte ch = strmBuf[bIdx];
if ( ch == keyw[ charMatchCount ] )
{
@@ -1273,8 +1274,6 @@ public abstract class BaseParser impleme
//so we are more compatible with POS writers that don't
//follow the spec
String badString = readString();
- //throw new IOException( "Unknown dir object c='" + c +
- //"' peek='" + (char)pdfSource.peek() + "' " + pdfSource );
if( badString == null || badString.length() == 0 )
{
int peek = pdfSource.peek();
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java?rev=1667287&r1=1667286&r2=1667287&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/function/PDFunctionType0.java Tue Mar 17 12:28:08 2015
@@ -325,9 +325,12 @@ public class PDFunctionType0 extends PDF
*/
class Rinterpol
{
- final float[] in; // coordinate that is to be interpolated
- final int[] inPrev; // coordinate of the "ceil" point
- final int[] inNext; // coordinate of the "floor" point
+ // coordinate that is to be interpolated
+ final float[] in;
+ // coordinate of the "ceil" point
+ final int[] inPrev;
+ // coordinate of the "floor" point
+ final int[] inNext;
final int numberOfInputValues;
final int numberOfOutputValues = getNumberOfOutputParameters();
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java?rev=1667287&r1=1667286&r2=1667287&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/digitalsignature/visible/PDVisibleSigBuilder.java Tue Mar 17 12:28:08 2015
@@ -294,24 +294,14 @@ public class PDVisibleSigBuilder impleme
PDStream imageFormStream, PDRectangle formrect, AffineTransform at,
PDImageXObject img) throws IOException
{
- // if you need text on the visible signature:
- //
- // PDFont font = PDTrueTypeFont.loadTTF(this.pdfStructure.getTemplate(),
- // new File("D:\\arial.ttf"));
- // font.setFontEncoding(new WinAnsiEncoding());
- //
- // Map<String, PDFont> fonts = new HashMap<String, PDFont>(); fonts.put("arial", font);
-
PDFormXObject imageForm = new PDFormXObject(imageFormStream);
imageForm.setBBox(formrect);
imageForm.setMatrix(at);
imageForm.setResources(imageFormResources);
imageForm.setFormType(1);
- // imageForm.getResources().addFont(font);
- // imageForm.getResources().setFonts(fonts);
-
imageFormResources.getCOSObject().setDirect(true);
+
COSName imageFormName = innerFormResource.add(imageForm, "n");
COSName imageName = imageFormResources.add(img, "img");
pdfStructure.setImageForm(imageForm);