[FOray-commit] SF.net SVN: foray: [8271] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-10-03 02:12:58
|
Revision: 8271
http://svn.sourceforge.net/foray/?rev=8271&view=rev
Author: victormote
Date: 2006-10-02 19:12:50 -0700 (Mon, 02 Oct 2006)
Log Message:
-----------
Modify a copy of the parameter, instead of the parameter itself.
Modified Paths:
--------------
trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
Modified: trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java
===================================================================
--- trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java 2006-10-03 01:54:03 UTC (rev 8270)
+++ trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java 2006-10-03 02:12:50 UTC (rev 8271)
@@ -103,7 +103,7 @@
Region region, RegionArea area) throws AreaWException;
public void handleLineBreakText(final LineOutput lineOutput,
- LineText text, final int startOffset, final int sizeInChars,
+ final LineText text, final int startOffset, final int sizeInChars,
final int sizeInline, final boolean hasDiscretionaryHyphen,
final boolean hasFauxSmallCaps, final boolean isLastItemOnLine)
throws TextException {
@@ -111,13 +111,14 @@
final LineArea lineArea = (LineArea) lineOutput;
RetrieveMarker retrieveMarker = null;
- if (text instanceof org.axsl.foR.FOLineText) {
- final FOLineText foLineText = (FOLineText) text;
+ LineText textToUse = text;
+ if (textToUse instanceof org.axsl.foR.FOLineText) {
+ final FOLineText foLineText = (FOLineText) textToUse;
retrieveMarker = foLineText.getRetrieveMarker();
- text = foLineText.getWrapped();
+ textToUse = foLineText.getWrapped();
}
- if (text instanceof FOText) {
- final FOText foText = (FOText) text;
+ if (textToUse instanceof FOText) {
+ final FOText foText = (FOText) textToUse;
lineArea.makeTextArea(foText, sizeInline, startOffset, sizeInChars,
hasDiscretionaryHyphen, hasFauxSmallCaps, isLastItemOnLine,
retrieveMarker);
@@ -127,33 +128,36 @@
}
public void handleLineBreakNonText(final LineOutput lineOutput,
- LineNonText nonText, final int sizeInline)
+ final LineNonText nonText, final int sizeInline)
throws TextException {
checkLayoutTarget(lineOutput);
final LineArea lineArea = (LineArea) lineOutput;
RetrieveMarker retrieveMarker = null;
- if (nonText instanceof org.axsl.foR.FOLineNonText) {
- final FOLineNonText foLineNonText = (FOLineNonText) nonText;
+ LineNonText nonTextToUse = nonText;
+ if (nonTextToUse instanceof org.axsl.foR.FOLineNonText) {
+ final FOLineNonText foLineNonText = (FOLineNonText) nonTextToUse;
retrieveMarker = foLineNonText.getRetrieveMarker();
- nonText = foLineNonText.getWrapped();
+ nonTextToUse = foLineNonText.getWrapped();
}
- if (nonText instanceof InstreamForeignObject) {
- final InstreamForeignObject ifo = (InstreamForeignObject) nonText;
+ if (nonTextToUse instanceof InstreamForeignObject) {
+ final InstreamForeignObject ifo = (InstreamForeignObject)
+ nonTextToUse;
lineArea.makeForeignObjectArea(ifo, sizeInline, retrieveMarker);
- } else if (nonText instanceof ExternalGraphic) {
- final ExternalGraphic graphic = (ExternalGraphic) nonText;
+ } else if (nonTextToUse instanceof ExternalGraphic) {
+ final ExternalGraphic graphic = (ExternalGraphic) nonTextToUse;
lineArea.makeExternalGraphicArea(graphic, sizeInline,
retrieveMarker);
- } else if (nonText instanceof Leader) {
- final Leader leader = (Leader) nonText;
+ } else if (nonTextToUse instanceof Leader) {
+ final Leader leader = (Leader) nonTextToUse;
lineArea.makeLeaderArea(leader, sizeInline, retrieveMarker);
- } else if (nonText instanceof PageNumberCitation) {
- final PageNumberCitation citation = (PageNumberCitation) nonText;
+ } else if (nonTextToUse instanceof PageNumberCitation) {
+ final PageNumberCitation citation = (PageNumberCitation)
+ nonTextToUse;
lineArea.makePageNumberCitationArea(citation, sizeInline,
retrieveMarker);
- } else if (nonText instanceof PageNumber) {
- final PageNumber pageNumber = (PageNumber) nonText;
+ } else if (nonTextToUse instanceof PageNumber) {
+ final PageNumber pageNumber = (PageNumber) nonTextToUse;
lineArea.makePageNumberArea(pageNumber, sizeInline, retrieveMarker);
}
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2006-10-03 01:54:03 UTC (rev 8270)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2006-10-03 02:12:50 UTC (rev 8271)
@@ -274,14 +274,14 @@
}
}
- private byte [] encryptWithHash(final byte [] data, byte [] hash,
+ private byte [] encryptWithHash(final byte [] data, final byte [] hash,
final int size) {
- hash = digest.digest(hash);
+ final byte[] hashToUse = digest.digest(hash);
final byte [] key = new byte[size];
for (int i = 0; i < size; i++) {
- key[i] = hash[i];
+ key[i] = hashToUse[i];
}
return encryptWithKey(data, key);
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2006-10-03 01:54:03 UTC (rev 8270)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2006-10-03 02:12:50 UTC (rev 8271)
@@ -82,7 +82,8 @@
* @param buffer
* @param glyphIndex
*/
- private void addCharToBuffer(final StringBuffer buffer, int glyphIndex) {
+ private void addCharToBuffer(final StringBuffer buffer,
+ final int glyphIndex) {
final Font font = this.font.getFontUse().getFont();
if (font.getFontComplexity() == Font.FONT_COMPOSITE) {
buffer.append(PDFString.getUnicodeString(glyphIndex));
@@ -94,10 +95,11 @@
buffer.append(Integer.toOctalString(glyphIndex));
return;
}
- if (glyphIndex < 0) {
- glyphIndex = ' ';
+ int glyphIndexToUse = glyphIndex;
+ if (glyphIndexToUse < 0) {
+ glyphIndexToUse = ' ';
}
- final char c = (char) glyphIndex;
+ final char c = (char) glyphIndexToUse;
switch (c) {
case '(':
case ')':
@@ -154,15 +156,16 @@
* @param c character to be converted
* @return the string representation of the character
*/
- public static String getUnicodeString(int c) {
+ public static String getUnicodeString(final int c) {
StringBuffer buf = new StringBuffer(4);
byte[] uniBytes = null;
+ int codePoint = c;
/* TODO: Handle Unicode characters > 0xFFFF better. */
- if (c < Character.MIN_VALUE
- || c > Character.MAX_VALUE) {
- c = ' ';
+ if (codePoint < Character.MIN_VALUE
+ || codePoint > Character.MAX_VALUE) {
+ codePoint = ' ';
}
- final char[] a = {(char) c};
+ final char[] a = {(char) codePoint};
try {
uniBytes = new String(a).getBytes("UnicodeBigUnmarked");
} catch (final Exception e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|