Changeset 4127


Ignore:
Timestamp:
06/21/08 08:45:10 (11 years ago)
Author:
melissa
Message:

Fixed array copying in openBytes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/ImageIOReader.java

    r4104 r4127  
    6666    throws FormatException, IOException 
    6767  { 
    68     buf = ImageTools.getBytes(openImage(no, x, y, w, h), false, no); 
     68    byte[] t = ImageTools.getBytes(openImage(no, x, y, w, h), false, no); 
    6969    int bytesPerChannel = w * h; 
    70     if (buf.length > bytesPerChannel) { 
    71       byte[] tmp = buf; 
     70    if (t.length > bytesPerChannel) { 
    7271      buf = new byte[bytesPerChannel * 3]; 
    7372      for (int i=0; i<3; i++) { 
    74         System.arraycopy(tmp, i * bytesPerChannel, buf, i*bytesPerChannel, 
     73        System.arraycopy(t, i * bytesPerChannel, buf, i*bytesPerChannel, 
    7574          bytesPerChannel); 
    7675      } 
    7776    } 
     77    else System.arraycopy(t, 0, buf, 0, (int) Math.min(t.length, buf.length)); 
    7878    return buf; 
    7979  } 
Note: See TracChangeset for help on using the changeset viewer.