You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by dv...@apache.org on 2006/12/07 10:46:39 UTC

svn commit: r483396 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/BaseScriptingEnvironment.java ext/awt/geom/RectListManager.java ext/awt/image/codec/tiff/TIFFDirectory.java gvt/text/GlyphLayout.java

Author: dvholten
Date: Thu Dec  7 01:46:37 2006
New Revision: 483396

URL: http://svn.apache.org/viewvc?view=rev&rev=483396
Log:
fix some problems with sign-extension, int-arithmetic, boolean expression

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java?view=diff&rev=483396&r1=483395&r2=483396
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/BaseScriptingEnvironment.java Thu Dec  7 01:46:37 2006
@@ -460,8 +460,10 @@
                                             buf[1] == (byte)0xff) {
                                         enc = "UTF-16BE";
                                         pbis.skip(2);
-                                    } else if (read >= 3 && buf[0] == 0xef &&
-                                            buf[1] == 0xbb && buf[2] == 0xbf) {
+                                    } else if (read >= 3
+                                            && buf[0] == (byte)0xef 
+                                            && buf[1] == (byte)0xbb
+                                            && buf[2] == (byte)0xbf) {
                                         enc = "UTF-8";
                                         pbis.skip(3);
                                     } else if (read >= 4 && buf[0] == 0 &&

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java?view=diff&rev=483396&r1=483395&r2=483396
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/geom/RectListManager.java Thu Dec  7 01:46:37 2006
@@ -36,8 +36,8 @@
  * this reason it uses Rectangle not Rectangle2D).
  *
  * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
- * @version $Id$ */
-
+ * @version $Id$
+ */
 public class RectListManager implements Collection {
     Rectangle [] rects = null;
     int size = 0;
@@ -317,7 +317,7 @@
         Rectangle rect = (Rectangle)o;
         int l=0, r=size-1, idx=0;
         while (l <= r) {
-            idx = (l+r)/2;
+            idx = (l+r) >>> 1;
             if (rect.x == rects[idx].x) break;
             if (rect.x <  rects[idx].x) {
                 if (idx == 0) break;
@@ -395,7 +395,7 @@
     public boolean remove(Rectangle rect) {
         int l=0, r=size-1, idx=0;
         while (l <= r) {
-            idx = (l+r)/2;
+            idx = (l+r) >>> 1;
             if (rect.x == rects[idx].x) break;
             if (rect.x <  rects[idx].x) {
                 if (idx == 0) break;

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java?view=diff&rev=483396&r1=483395&r2=483396
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/tiff/TIFFDirectory.java Thu Dec  7 01:46:37 2006
@@ -48,6 +48,7 @@
  * be removed or changed in future releases of JAI.</b>
  *
  * @see TIFFField
+ * @version $Id$
  */
 public class TIFFDirectory extends Object implements Serializable {
 
@@ -117,7 +118,7 @@
             }
 
             stream.seek(ifd_offset);
-            int entries = readUnsignedShort(stream);
+            long entries = readUnsignedShort(stream);
             stream.skip(12*entries);
 
             ifd_offset = readUnsignedInt(stream);
@@ -160,7 +161,7 @@
         int dirNum = 0;
         while(dirNum < directory) {
             // Get the number of fields in the current IFD.
-            int numEntries = readUnsignedShort(stream);
+            long numEntries = readUnsignedShort(stream);
 
             // Skip to the next IFD offset value field.
             stream.seek(ifd_offset + 12*numEntries);
@@ -592,7 +593,7 @@
             ++numDirectories;
 
             stream.seek(offset);
-            int entries = readUnsignedShort(stream, isBigEndian);
+            long entries = readUnsignedShort(stream, isBigEndian);
             stream.skip(12*entries);
             offset = readUnsignedInt(stream, isBigEndian);
         }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java?view=diff&rev=483396&r1=483395&r2=483396
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GlyphLayout.java Thu Dec  7 01:46:37 2006
@@ -1951,7 +1951,7 @@
      */
     protected boolean isLatinChar(char c) {
 
-        if ( c < 255 & Character.isLetterOrDigit( c )){
+        if ( c < 255 && Character.isLetterOrDigit( c )){
             // cheap quick check, should catch most lation-chars
             return true;
         }