Ignore the System.out.println statements...

// Claes



|---------+---------------------------->
|         |           claes.bergsten@tj|
|         |           group.com        |
|         |                            |
|         |           14.05.2002 17:40 |
|         |           Please respond to|
|         |           fop-dev          |
|         |                            |
|---------+---------------------------->
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                                              |
  |       To:       [EMAIL PROTECTED]                                             
                                                              |
  |       cc:       (bcc: Claes Bergsten/NO/TJG)                                       
                                                              |
  |       Subject:  Error when reading EPS images                                      
                                                              |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|




Hi,

I found an error when fop proceses EPS images with negative numbers in
BoundingBox.

It only checks for ASCII codes between 48 and 57 and therefor quits
immediately when
the first char is '-'.

I changed the line (marked in the code snippet below) from:

while (nidx < epsFile.length && (epsFile[nidx] >= 48 && epsFile[nidx] <=
57))
to:
while (nidx < epsFile.length && ((epsFile[nidx] >= 48 && epsFile[nidx] <=
57)||epsFile[nidx] == 45))

This solves the problem I encountered.
Since I have not performed updates before I figured it would be quicker if
anyone with experience made the change for me.

Would tyake the oppurtunity to thank you for a good product and good
support. :-)

Package: org.apache.fop.image.analyser
File: EPSReader.java
...
    private int readLongString(long[] mbbox, int i, int idx) {
        while (idx < epsFile.length && (epsFile[idx] == 32))
               idx++;

        int nidx = idx;

----->  while (nidx < epsFile.length && ((epsFile[nidx] >= 48 &&
epsFile[nidx] <= 57)||epsFile[nidx] == 45))
            nidx++;

        System.out.println( "Idx: " + idx + " Nidx: " + nidx);

        byte[] num = new byte[nidx - idx];
        System.arraycopy(epsFile, idx, num, 0, nidx-idx);
        String ns = new String(num);

        System.out.println( "Stringnumber: " + ns);

        mbbox[i] = Long.parseLong(ns);

        return (1+nidx - idx);
    }
...

cheers

-------------------------------------------------------
Claes Bergsten
Software Development Engineer
TJ Group as

--------------Contact----------------------------
[EMAIL PROTECTED]
+47 91668984
www.tjgroup.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to